Переглянути джерело

* Fixed some bugs in readuserfile()

svn: 503
Bryan Drewery 22 роки тому
батько
коміт
0dc97002e6
2 змінених файлів з 8 додано та 13 видалено
  1. 1 0
      doc/UPDATES
  2. 7 13
      src/users.c

+ 1 - 0
doc/UPDATES

@@ -21,6 +21,7 @@ This is a summary of ChangeLog basically.
 18.cmd_mop didn't check for n| with '*' as a chan.
 19.Added help entry for cmd_whom.
 20.chanset #chan +/-inactive now requires global n|-
+21.Fixed some bugs in the readuserfile() function.
 
 1.0.13
 1.Fixed a fatal bug in console_gotshare()

+ 7 - 13
src/users.c

@@ -679,7 +679,6 @@ void tell_users_match(int idx, char *mtch, int start, int limit,
 int readuserfile(char *file, struct userrec **ret)
 {
   char *p, buf[1024], lasthand[512], *attr, *pass, *code, s1[1024], *s, cbuf[1024], *temps;
-
   FILE *f;
   struct userrec *bu, *u = NULL;
   struct chanset_t *cst = NULL;
@@ -688,7 +687,6 @@ int readuserfile(char *file, struct userrec **ret)
   struct flag_record fr;
   struct chanuserrec *cr;
 
-Context;
   bu = (*ret);
   ignored[0] = 0;
   if (bu == userlist) {
@@ -706,9 +704,9 @@ Context;
   noshare = 1;
   /* read opening comment */
   s = buf;
-  fscanf(f, "%[^\n]\n", cbuf);
+  fgets(cbuf, 180, f);
   temps = (char *) decrypt_string(SALT1, cbuf);
-  egg_snprintf(s, 1024, temps);
+  egg_snprintf(s, 180, temps);
   nfree(temps);
   if (s[1] < '4') {
     fatal(USERF_OLDFMT, 0);
@@ -717,7 +715,7 @@ Context;
     fatal(USERF_INVALID, 0);
   while (!feof(f)) {
     s = buf;
-    fscanf(f, "%[^\n]\n", cbuf);
+    fgets(cbuf, 1024, f);
     temps = (char *) decrypt_string(SALT1, cbuf);
     egg_snprintf(s, 1024, temps);
     nfree(temps);
@@ -812,16 +810,12 @@ Context;
 	      }
 	    }
 	  }
-        } else if (!strcmp(code, "+")) {  // channels
-         int code2;
-Context;
+        } else if (!strcmp(code, "+")) {
          if (s[0] && lasthand[0] == '*' && lasthand[1] == CHANS_NAME[1]) {
-	  code2 = Tcl_Eval(interp, s);
-          if (code2 != TCL_OK) {
+          if (Tcl_Eval(interp, s) != TCL_OK) {
            putlog(LOG_MISC, "*", "Tcl error in userfile");
-           putlog(LOG_MISC, "*", "%s",
-            Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY));
-           return 0;
+           putlog(LOG_MISC, "*", "%s", Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY));
+           return 1;
           }
          }
 	} else if (!strncmp(code, "::", 2)) {