Przeglądaj źródła

* Fix regression in oidentd support

Bryan Drewery 16 lat temu
rodzic
commit
4c5b53dd06
2 zmienionych plików z 34 dodań i 32 usunięć
  1. 34 28
      src/dccutil.c
  2. 0 4
      src/net.c

+ 34 - 28
src/dccutil.c

@@ -965,40 +965,46 @@ listen_all(port_t lport, bool off, bool should_v6)
 void
 identd_open(const char *sourceIp, const char *destIp, int identd)
 {
-  int idx;
-  int i = -1;
-  port_t port = 113;
+#ifndef CYGWIN_HACKS
+  // Only open identd socket if running as root or on cygwin.
+  if (!conf.uid)
+#endif
+  {
+    int idx;
+    int i = -1;
+    port_t port = 113;
 
-  for (idx = 0; idx < dcc_total; idx++)
-    if (dcc[idx].type == &DCC_IDENTD_CONNECT)
-      return;                   /* it's already open :) */
+    for (idx = 0; idx < dcc_total; idx++)
+      if (dcc[idx].type == &DCC_IDENTD_CONNECT)
+        return;                   /* it's already open :) */
 
-  idx = -1;
+    idx = -1;
 
-  identd_hack = 1;
+    identd_hack = 1;
 #ifdef USE_IPV6
-  i = open_listen_by_af(&port, AF_INET6);
+    i = open_listen_by_af(&port, AF_INET6);
 #else
-  i = open_listen(&port);
+    i = open_listen(&port);
 #endif /* USE_IPV6 */
-  identd_hack = 0;
-  if (i >= 0) {
-    idx = new_dcc(&DCC_IDENTD_CONNECT, 0);
-    if (idx >= 0) {
-      egg_timeval_t howlong;
-
-      dcc[idx].addr = iptolong(getmyip());
-      dcc[idx].port = port;
-      dcc[idx].sock = i;
-      dcc[idx].timeval = now;
-      strlcpy(dcc[idx].nick, "(identd)", sizeof(dcc[idx].nick));
-      strlcpy(dcc[idx].host, "*", sizeof(dcc[idx].host));
-      putlog(LOG_DEBUG, "*", "Identd daemon started.");
-      howlong.sec = 15;
-      howlong.usec = 0;
-      timer_create(&howlong, "identd_close()", (Function) identd_close);
-    } else
-      killsock(i);
+    identd_hack = 0;
+    if (i >= 0) {
+      idx = new_dcc(&DCC_IDENTD_CONNECT, 0);
+      if (idx >= 0) {
+        egg_timeval_t howlong;
+
+        dcc[idx].addr = iptolong(getmyip());
+        dcc[idx].port = port;
+        dcc[idx].sock = i;
+        dcc[idx].timeval = now;
+        strlcpy(dcc[idx].nick, "(identd)", sizeof(dcc[idx].nick));
+        strlcpy(dcc[idx].host, "*", sizeof(dcc[idx].host));
+        putlog(LOG_DEBUG, "*", "Identd daemon started.");
+        howlong.sec = 15;
+        howlong.usec = 0;
+        timer_create(&howlong, "identd_close()", (Function) identd_close);
+      } else
+        killsock(i);
+    }
   }
 
   /* Only makes sense if we're spoofing by nick */

+ 0 - 4
src/net.c

@@ -579,10 +579,6 @@ int open_telnet_raw(int sock, const char *ipIn, port_t sport, bool proxy_on, int
     socklist[i].port = port;
   }
 
-#ifndef CYGWIN_HACKS
-  // Only open identd socket if running as root or on cygwin.
-  if (!conf.uid)
-#endif
   if (identd && sport) //Only open identd if not a unix domain socket
     identd_open(myipstr(is_resolved), ipIn, identd);