]> jfr.im git - irc/unrealircd/unrealircd.git/commitdiff
- Removed anything involving portnum global variable. Not proper in
authorstskeeps <redacted>
Mon, 11 Jun 2007 18:36:05 +0000 (18:36 +0000)
committerstskeeps <redacted>
Mon, 11 Jun 2007 18:36:05 +0000 (18:36 +0000)
  newconf world
- #0002920 reported by aquanight, regarding command line mkpasswd,
  patched by BuHHunyx. Syntax: wircd.exe -P|-p authmethod password.
  If it is -p, it will get shown in a MessageBox, -P it will get copied
to clipboard

Changes
src/ircd.c
src/s_bsd.c
u4modules/Velcro.module
wircd.def

diff --git a/Changes b/Changes
index 4fe811c0c8ab625b4ae69b303d6769a1c82a4249..b402b91526bfc4ab469d56cecd93bb48d79732b1 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1760,3 +1760,9 @@ MOTDs
   matches the umode for now)
 - #0002695 reported by w00t regarding unused check_registered and 
   check_registered_user calls in s_misc.c
+- Removed anything involving portnum global variable. Not proper in 
+  newconf world
+- #0002920 reported by aquanight, regarding command line mkpasswd, 
+  patched by BuHHunyx. Syntax: wircd.exe -P|-p authmethod password.
+  If it is -p, it will get shown in a MessageBox, -P it will get copied
+  to clipboard.
index 5308d87b194c6de4687e4f2857062ee2d0a4b753..7bd85557ee01d13537b7011a2e217f09c7252ed9 100644 (file)
@@ -186,7 +186,6 @@ MODVAR char **myargv;
 #else
 LPCSTR cmdLine;
 #endif
-int  portnum = -1;             /* Server port number, listening this */
 char *configfile = CONFIGFILE; /* Server configuration file */
 int  debuglevel = 10;          /* Server debug level */
 int  bootopt = 0;              /* Server boot option flags */
@@ -807,13 +806,13 @@ static int bad_command(void)
 {
 #ifndef _WIN32
        (void)printf
-           ("Usage: ircd [-f config] [-h servername] [-p portnumber] [-x loglevel] [-t] [-H]\n");
+           ("Usage: ircd [-f config] [-h servername] [-x loglevel] [-t] [-H]\n");
        (void)printf("Server not started\n\n");
 #else
        if (!IsService)
        {
                MessageBox(NULL,
-                   "Usage: wircd [-h servername] [-p portnumber] [-x loglevel]\n",
+                   "Usage: wircd [-h servername] [-x loglevel]\n",
                    "UnrealIRCD/32", MB_OK);
        }
 #endif
@@ -1217,6 +1216,7 @@ int InitwIRCD(int argc, char *argv[])
                          break;
 #endif
 #ifndef _WIN32
+                 case 'p':
                  case 'P':
                  {
                          short type;
@@ -1245,12 +1245,55 @@ int InitwIRCD(int argc, char *argv[])
                          printf("Encrypted password is: %s\n", result);
                          exit(0);
                  }
+#else /* _WIN32 */
+                 case 'p':
+                 case 'P':{
+                         short type;
+                         char *result;
+                         srand(TStime());
+                         if ((type = Auth_FindType(p)) == -1) {
+                                 MessageBox(NULL, p, "No such auth type", MB_ICONERROR | MB_OK);
+                                 return 0;
+                         }
+                         p = *++argv;
+                         argc--;
+#ifdef AUTHENABLE_UNIXCRYPT
+                         if ((type == AUTHTYPE_UNIXCRYPT) && (strlen(p) > 8))
+                         {
+                             MessageBox(NULL, "Password truncated to 8 characters due to 'crypt' algorithm. "
+                                "You are suggested to use the 'md5' algorithm instead.", "WARNING", MB_ICONWARNING | MB_OK);
+                                 p[8] = '\0';
+                         }
+#endif
+                         if (!(result = Auth_Make(type, p))) {
+                                 MessageBox(NULL, "Authentication failed\n", "ERROR", MB_ICONERROR | MB_OK);
+                                 return 0;
+                         }
+                         
+                         if (flag == 'p')
+                                 MessageBox(NULL, result, "Encrypted password", MB_ICONINFORMATION | MB_OK);*/
+                         else
+                         if (OpenClipboard(NULL))
+                         {
+                             LPTSTR lptstrCopy; 
+                             HGLOBAL hglbCopy;
+                             hglbCopy = GlobalAlloc(GMEM_MOVEABLE, lstrlen(result) + 1);
+                             if(hglbCopy != NULL)
+                             {
+                                 lptstrCopy = GlobalLock(hglbCopy); 
+                                 lstrcpy(lptstrCopy, result);
+                                 GlobalUnlock(hglbCopy);
+                                 EmptyClipboard();
+                                 SetClipboardData(CF_TEXT, hglbCopy); 
+                                 MessageBox(NULL, "Encrypted password copied to the clipboard",
+                                       "Encrypted password", MB_ICONINFORMATION | MB_OK);
+                             }
+                             CloseClipboard();
+                         }
+                         exit 0;
+                 }
 #endif
 
-                 case 'p':
-                         if ((portarg = atoi(p)) > 0)
-                                 portnum = portarg;
-                         break;
                  case 's':
                          (void)printf("sizeof(aClient) == %ld\n",
                              (long)sizeof(aClient));
@@ -1506,9 +1549,6 @@ int InitwIRCD(int argc, char *argv[])
 #else /* ifndef NEW_IO */
 #endif /* ifndef NEW_IO */
 #endif
-       if (portnum < 0)
-               portnum = PORTNUM;
-       me.port = portnum;
 #ifndef NEW_IO
        /* Is that have to be in s_bsd.c huh? */
        (void)init_sys();
@@ -1530,6 +1570,7 @@ int InitwIRCD(int argc, char *argv[])
         * We accept the first listen record 
         */
        portnum = conf_listen->port;
+       me.port = portnum;
 /*
  *      This is completely unneeded-Sts
        me.ip.S_ADDR =
index 89fa6b28aa57a6e625384779c8c1d1bdf6318d3e..9e3fbac46689ce59abbf8639416fda60ca1f7ce5 100644 (file)
@@ -2098,7 +2098,7 @@ static struct SOCKADDR *connect_inet(ConfigItem_link * aconf, aClient *cptr,
        bcopy((char *)&aconf->ipnum, (char *)&server.SIN_ADDR,
            sizeof(struct IN_ADDR));
        bcopy((char *)&aconf->ipnum, (char *)&cptr->ip, sizeof(struct IN_ADDR));
-       server.SIN_PORT = htons(((aconf->port > 0) ? aconf->port : portnum));
+       server.SIN_PORT = htons(aconf->port);
        *lenp = sizeof(server);
        return (struct SOCKADDR *)&server;
 }
index 82159e16f906f24b0c2d794ce357d6156e576e07..7865e1d2cfddff252ba39057182b87aeeaa34443 100644 (file)
@@ -136,7 +136,7 @@ DLLFUNC int h_velcro_configrun(ConfigFile *cf, ConfigEntry *ce, int type, int *e
         if(!strcmp(ce->ce_varname, "loadmodule4")) {
                config_status("%s:%i: loadmodule4: %s",
                        ce->ce_fileptr->cf_filename, ce->ce_varlinenum, ce->ce_vardata);
-               Velcro::instanceOf().dependsOnModule("Velcro", ce->ce_vardata);
+               Velcro::instanceOf().dependsOnModule(".conf", ce->ce_vardata);
                 return 1;
         }
         return 0;
@@ -317,3 +317,4 @@ bool Velcro::isModuleLoading(const char *moduleName)
        }
        return false;
 }
+
index e59075ba70e642a3a23dfa76b87bb24a3838b1ce..c5140dff7975f51781084840e29c50f8d4a9ef1c 100644 (file)
--- a/wircd.def
+++ b/wircd.def
@@ -667,7 +667,6 @@ EXPORTS
        parse_netmask
        place_host_ban
        port_range
-       portnum
        pretty_mask
        pretty_time_val
        proceed_normal_client_handshake