Commit Diff


commit - 6591f17f0a54e41beac5dd5bd348b4ff7e083163
commit + b99af4fa47ed531c4410018db54734604fd286ab
blob - 133851a9b540e4701e21dc93a06dc2f80333dfc9
blob + dfa0e94d35822b89fe830ec5a07cafb868f2b81a
--- src/ngircd/irc.c
+++ src/ngircd/irc.c
@@ -9,7 +9,7 @@
  * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
  * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
  *
- * $Id: irc.c,v 1.104 2002/11/30 17:39:56 alex Exp $
+ * $Id: irc.c,v 1.105 2002/12/06 17:02:39 alex Exp $
  *
  * irc.c: IRC-Befehle
  */
@@ -51,32 +51,41 @@ GLOBAL BOOLEAN
 IRC_KILL( CLIENT *Client, REQUEST *Req )
 {
 	CLIENT *prefix, *c;
+	CHAR reason[COMMAND_LEN];
 
 	assert( Client != NULL );
 	assert( Req != NULL );
 
+	/* is the user an IRC operator? */
+	if(( Client_Type( Client ) != CLIENT_SERVER ) && ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
+
 	/* Falsche Anzahl Parameter? */
 	if(( Req->argc != 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
 
-	prefix = Client_Search( Req->prefix );
+	if( Req->prefix ) prefix = Client_Search( Req->prefix );
+	else prefix = Client;
 	if( ! prefix )
 	{
 		Log( LOG_WARNING, "Got KILL with invalid prefix: \"%s\"!", Req->prefix );
 		prefix = Client_ThisServer( );
 	}
 
-	Log( LOG_NOTICE, "Got KILL command from \"%s\" for \"%s\": %s", Client_Mask( prefix ), Req->argv[0], Req->argv[1] );
+	Log( LOG_NOTICE|LOG_snotice, "Got KILL command from \"%s\" for \"%s\": %s", Client_Mask( prefix ), Req->argv[0], Req->argv[1] );
 
+	/* build reason string */
+	if( Client_Type( Client ) == CLIENT_USER ) sprintf( reason, "KILLed by %s: %s", Client_ID( Client ), Req->argv[1] );
+	else strcpy( reason, Req->argv[1] );
+
 	/* andere Server benachrichtigen */
-	IRC_WriteStrServersPrefix( Client, prefix, "KILL %s :%s", Req->argv[0], Req->argv[1] );
+	IRC_WriteStrServersPrefix( Client, prefix, "KILL %s :%s", Req->argv[0], reason );
 
 	/* haben wir selber einen solchen Client? */
 	c = Client_Search( Req->argv[0] );
 	if( c )
 	{
 		/* Ja, wir haben einen solchen Client */
-		if( Client_Conn( c ) != NONE ) Conn_Close( Client_Conn( c ), NULL, Req->argv[1], TRUE );
-		else Client_Destroy( c, NULL, Req->argv[1], TRUE );
+		if( Client_Conn( c ) != NONE ) Conn_Close( Client_Conn( c ), NULL, reason, TRUE );
+		else Client_Destroy( c, NULL, reason, TRUE );
 	}
 	else Log( LOG_NOTICE, "Client with nick \"%s\" is unknown here.", Req->argv[0] );
 
blob - d46d6cad3ddf61f30aa3947a3c8d328ad909aad1
blob + 0f47f2d489fa965a0409d5a4813ae0767b0f516f
--- src/ngircd/parse.c
+++ src/ngircd/parse.c
@@ -9,7 +9,7 @@
  * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
  * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
  *
- * $Id: parse.c,v 1.49 2002/11/30 17:39:56 alex Exp $
+ * $Id: parse.c,v 1.50 2002/12/06 17:02:39 alex Exp $
  *
  * parse.c: Parsen der Client-Anfragen
  */
@@ -69,7 +69,7 @@ COMMAND My_Commands[] =
 	{ "ISON", IRC_ISON, CLIENT_USER, 0 },
 	{ "JOIN", IRC_JOIN, CLIENT_USER|CLIENT_SERVER, 0 },
 	{ "KICK", IRC_KICK, CLIENT_USER|CLIENT_SERVER, 0 },
-	{ "KILL", IRC_KILL, CLIENT_SERVER, 0 },
+	{ "KILL", IRC_KILL, CLIENT_USER|CLIENT_SERVER, 0 },
 	{ "LINKS", IRC_LINKS, CLIENT_USER|CLIENT_SERVER, 0 },
 	{ "LIST", IRC_LIST, CLIENT_USER|CLIENT_SERVER, 0 },
 	{ "LUSERS", IRC_LUSERS, CLIENT_USER|CLIENT_SERVER, 0 },