Просмотр исходного кода

* natip is now only referenced in getmyip()

svn: 1383
Bryan Drewery 21 лет назад
Родитель
Сommit
40d50f82e6
7 измененных файлов с 7 добавлено и 12 удалено
  1. 1 2
      src/mod/share.mod/share.c
  2. 1 3
      src/mod/transfer.mod/transfer.c
  3. 1 3
      src/mod/update.mod/update.c
  4. 2 1
      src/net.c
  5. 1 1
      src/net.h
  6. 0 1
      src/users.c
  7. 1 1
      src/users.h

+ 1 - 2
src/mod/share.mod/share.c

@@ -1478,8 +1478,7 @@ start_sending_users(int idx)
     dcc[idx].status |= STAT_SENDING;
     dcc[idx].status |= STAT_SENDING;
     i = dcc_total - 1;
     i = dcc_total - 1;
     strcpy(dcc[i].host, dcc[idx].nick); /* Store bot's nick */
     strcpy(dcc[i].host, dcc[idx].nick); /* Store bot's nick */
-    dprintf(idx, "s us %lu %d %lu\n", iptolong(natip[0] ? (in_addr_t) inet_addr(natip) : getmyip()), dcc[i].port,
-            dcc[i].u.xfer->length);
+    dprintf(idx, "s us %lu %d %lu\n", iptolong(getmyip()), dcc[i].port, dcc[i].u.xfer->length);
 
 
     /* Unlink the file. We don't really care whether this causes problems
     /* Unlink the file. We don't really care whether this causes problems
      * for NFS setups. It's not worth the trouble.
      * for NFS setups. It's not worth the trouble.

+ 1 - 3
src/mod/transfer.mod/transfer.c

@@ -1155,9 +1155,7 @@ static int raw_dcc_resend_send(char *filename, char *nick, char *from, char *dir
   dcc[i].u.xfer->type = resend ? XFER_RESEND_PEND : XFER_SEND;
   dcc[i].u.xfer->type = resend ? XFER_RESEND_PEND : XFER_SEND;
   if (nick[0] != '*') {
   if (nick[0] != '*') {
     dprintf(DP_HELP, "PRIVMSG %s :\001DCC %sSEND %s %lu %d %lu\001\n", nick,
     dprintf(DP_HELP, "PRIVMSG %s :\001DCC %sSEND %s %lu %d %lu\001\n", nick,
-	    resend ? "RE" :  "", nfn,
-	    iptolong(natip[0] ? (in_addr_t) inet_addr(natip) : getmyip()), port,
-	    dccfilesize);
+	    resend ? "RE" :  "", nfn, iptolong(getmyip()), port, dccfilesize);
     putlog(LOG_FILES, "*",TRANSFER_BEGIN_DCC, resend ? TRANSFER_RE :  "",
     putlog(LOG_FILES, "*",TRANSFER_BEGIN_DCC, resend ? TRANSFER_RE :  "",
 	   nfn, nick);
 	   nfn, nick);
   }
   }

+ 1 - 3
src/mod/update.mod/update.c

@@ -350,9 +350,7 @@ static void start_sending_binary(int idx)
     dcc[idx].status |= STAT_SENDINGU;
     dcc[idx].status |= STAT_SENDINGU;
     i = dcc_total - 1;
     i = dcc_total - 1;
     strcpy(dcc[i].host, dcc[idx].nick);		/* Store bot's nick */
     strcpy(dcc[i].host, dcc[idx].nick);		/* Store bot's nick */
-    dprintf(idx, "sb us %lu %hd %lu\n",
-	    iptolong(natip[0] ? (in_addr_t) inet_addr(natip) : getmyip()),
-	    dcc[i].port, dcc[i].u.xfer->length);
+    dprintf(idx, "sb us %lu %hd %lu\n", iptolong(getmyip()), dcc[i].port, dcc[i].u.xfer->length);
   }
   }
 #endif /* HUB */
 #endif /* HUB */
 }
 }

+ 2 - 1
src/net.c

@@ -46,6 +46,7 @@ union sockaddr_union cached_myip4_so;
 union sockaddr_union cached_myip6_so;
 union sockaddr_union cached_myip6_so;
 #endif /* USE_IPV6 */
 #endif /* USE_IPV6 */
 
 
+char 	natip[121] = "";
 bool    identd_hack = 0;	/* identd_open() won't work on most servers, dont even bother warning. */
 bool    identd_hack = 0;	/* identd_open() won't work on most servers, dont even bother warning. */
 char	firewall[121] = "";	/* Socks server for firewall		    */
 char	firewall[121] = "";	/* Socks server for firewall		    */
 port_t	firewallport = 1080;	/* Default port of Sock4/5 firewalls	    */
 port_t	firewallport = 1080;	/* Default port of Sock4/5 firewalls	    */
@@ -261,7 +262,7 @@ char *myipstr(int af_type)
 /* Get my ip number
 /* Get my ip number
  */
  */
 in_addr_t getmyip() {
 in_addr_t getmyip() {
-  return cached_myip4_so.sin.sin_addr.s_addr;
+  return natip[0] ? inet_addr(natip) : cached_myip4_so.sin.sin_addr.s_addr;
 }
 }
 
 
 /* see if it's necessary to set inaddr_any... because if we can't resolve, we die anyway */
 /* see if it's necessary to set inaddr_any... because if we can't resolve, we die anyway */

+ 1 - 1
src/net.h

@@ -172,7 +172,7 @@ extern union sockaddr_union 		cached_myip6_so;
 extern unsigned long			notalloc;
 extern unsigned long			notalloc;
 #endif /* USE_IPV6 */
 #endif /* USE_IPV6 */
 
 
-extern char				firewall[], botuser[];
+extern char				firewall[], botuser[], natip[];
 extern int				resolve_timeout, MAXSOCKS;
 extern int				resolve_timeout, MAXSOCKS;
 extern bool				identd_hack;
 extern bool				identd_hack;
 extern port_t				firewallport;
 extern port_t				firewallport;

+ 0 - 1
src/users.c

@@ -37,7 +37,6 @@
 #include "misc_file.h"
 #include "misc_file.h"
 #endif /* HUB */
 #endif /* HUB */
 
 
-char natip[121] = "";
 char userfile[121] = "";	/* where the user records are stored */
 char userfile[121] = "";	/* where the user records are stored */
 time_t ignore_time = 10;		/* how many minutes will ignores last? */
 time_t ignore_time = 10;		/* how many minutes will ignores last? */
 
 

+ 1 - 1
src/users.h

@@ -176,7 +176,7 @@ int readuserfile(const char *, struct userrec **);
 void check_pmode();
 void check_pmode();
 void link_pref_val(struct userrec *u, char *lval);
 void link_pref_val(struct userrec *u, char *lval);
 
 
-extern char			natip[], userfile[];
+extern char			userfile[];
 extern time_t			ignore_time;
 extern time_t			ignore_time;
 
 
 #endif				/* _EGG_USERS_H */
 #endif				/* _EGG_USERS_H */