[eggheads-patches] PATCH: sufix.patch

Fabian Knittel fknittel at gmx.de
Fri Oct 8 22:43:10 CST 1999


[ sufix.patch ]

.su now doesn't expect the target user to have a password set
if the calling user is an owner, as they wouldn't need to
know the password anyway.

Also adds a short note to the help for .su, that you can return
to your originating user by typing `.quit'.

Fabian
-------------- next part --------------
diff -urN eggdrop1.3~/doc/UPDATES1.3 eggdrop1.3/doc/UPDATES1.3
--- eggdrop1.3~/doc/UPDATES1.3	Fri Oct  8 12:50:06 1999
+++ eggdrop1.3/doc/UPDATES1.3	Sat Oct  9 00:48:16 1999
@@ -4,6 +4,8 @@
 
 1.3.29
 Foundby   Fixedby   What....
+Ben	  Fabian    .su doesn't expect a pwd for the target user anymore, if
+		    called as an owner
           dw        kicks weren't being logged
           rtc       added assert debugging feature
 	  Fabian    main() wasn't removing unknown sockets correctly
diff -urN eggdrop1.3~/help/cmds2.help eggdrop1.3/help/cmds2.help
--- eggdrop1.3~/help/cmds2.help	Fri Oct  8 12:50:10 1999
+++ eggdrop1.3/help/cmds2.help	Sat Oct  9 00:44:16 1999
@@ -199,6 +199,8 @@
    changes your username to that of another. If you 
    are an owner this does not require a password
    otherwise, you must enter the password of <user>.
+
+   %b.quit%b returns you to your original user.
 %{help=trace}
 ###  %btrace%b <bot>
    sends out a trace signal to another bot.  if that trace signal
diff -urN eggdrop1.3~/src/cmds.c eggdrop1.3/src/cmds.c
--- eggdrop1.3~/src/cmds.c	Fri Oct  8 12:50:30 1999
+++ eggdrop1.3/src/cmds.c	Sat Oct  9 00:42:55 1999
@@ -1970,8 +1970,7 @@
 static void cmd_su(struct userrec *u, int idx, char *par)
 {
   int atr = u ? u->flags : 0;
-  struct flag_record fr =
-  {FR_ANYWH | FR_CHAN | FR_GLOBAL, 0, 0, 0, 0, 0};
+  struct flag_record fr = {FR_ANYWH | FR_CHAN | FR_GLOBAL, 0, 0, 0, 0, 0};
 
   context;
   u = get_user_by_handle(userlist, par);
@@ -1982,8 +1981,6 @@
     dprintf(idx, "No such user.\n");
   else if (u->flags & USER_BOT)
     dprintf(idx, "Can't su to a bot... then again, why would you wanna?\n");
-  else if (u_pass_match(u, "-"))
-    dprintf(idx, "No password set for user. You may not .su to them\n");
   else if (dcc[idx].u.chat->su_nick)
     dprintf(idx, "You cannot currently double .su, try .su'ing directly\n");
   else {
@@ -1997,6 +1994,11 @@
       if (!(atr & USER_OWNER) ||
 	  ((atr & USER_OWNER) && !(isowner(dcc[idx].nick))) ||
 	  ((u->flags & USER_OWNER) && (isowner(par)))) {
+	/* This check is only important for non-owners */
+	if (u_pass_match(u, "-")) {
+	  dprintf(idx, "No password set for user. You may not .su to them\n");
+	  return;
+	}
 	if (dcc[idx].u.chat->channel < 100000)
 	  botnet_send_part_idx(idx, "");
 	chanout_but(-1, dcc[idx].u.chat->channel,
@@ -2006,11 +2008,9 @@
 	 * their password right ;) */
 	if (dcc[idx].u.chat->away != NULL)
 	  nfree(dcc[idx].u.chat->away);
-	dcc[idx].u.chat->away = n_malloc(strlen(dcc[idx].nick) + 1,
-					 "dccutil.c", 9999);	/* evil hack :) */
+	dcc[idx].u.chat->away = get_data_ptr(strlen(dcc[idx].nick) + 1);
 	strcpy(dcc[idx].u.chat->away, dcc[idx].nick);
-	dcc[idx].u.chat->su_nick = n_malloc(strlen(dcc[idx].nick) + 1,
-					    "dccutil.c", 9999);
+	dcc[idx].u.chat->su_nick = get_data_ptr(strlen(dcc[idx].nick) + 1);
 	strcpy(dcc[idx].u.chat->su_nick, dcc[idx].nick);
 	dcc[idx].user = u;
 	strcpy(dcc[idx].nick, par);
@@ -2025,7 +2025,7 @@
 	dprintf(idx, "Setting your username to %s.\n", par);
 	if (atr & USER_MASTER)
 	  dcc[idx].u.chat->con_flags = conmask;
-	dcc[idx].u.chat->su_nick = n_malloc(strlen(dcc[idx].nick) + 1, "dccutil.c", 9999);
+	dcc[idx].u.chat->su_nick = get_data_ptr(strlen(dcc[idx].nick) + 1);
 	strcpy(dcc[idx].u.chat->su_nick, dcc[idx].nick);
 	dcc[idx].user = u;
 	strcpy(dcc[idx].nick, par);


More information about the Patches mailing list