فهرست منبع

* CYGWIN fixes :)

svn: 845
Bryan Drewery 22 سال پیش
والد
کامیت
c9e12675e4
21فایلهای تغییر یافته به همراه453 افزوده شده و 292 حذف شده
  1. 1 1
      autotools/Makefile
  2. 5 12
      autotools/configure.ac
  3. 5 2
      autotools/includes/acinclude.m4
  4. 248 231
      configure
  5. 2 2
      src/bg.c
  6. 2 2
      src/cmds.c
  7. 3 1
      src/compat/inet_ntop.c
  8. 2 6
      src/compat/inet_ntop.h
  9. 20 5
      src/conf.c
  10. 2 2
      src/crypt.c
  11. 2 9
      src/crypt.h
  12. 86 0
      src/dcc.c
  13. 1 1
      src/dcc.h
  14. 23 0
      src/dccutil.c
  15. 1 0
      src/dccutil.h
  16. 6 4
      src/debug.c
  17. 24 12
      src/main.c
  18. 1 1
      src/mod/ctcp.mod/ctcp.c
  19. 1 1
      src/net.c
  20. 4 0
      src/net.h
  21. 14 0
      src/shell.c

+ 1 - 1
autotools/Makefile

@@ -4,7 +4,7 @@ all: clean aclocal autoheader autoconf clean_again
 
 aclocal:
 	@rm -rf aclocal.m4
-	aclocal-1.6 -I includes/
+	aclocal -I includes/
 
 autoheader:
 	@rm -rf ../config.h.in

+ 5 - 12
autotools/configure.ac

@@ -48,6 +48,11 @@ AC_CHECK_PROG(DISTCC, distcc, distcc)
 EGG_CHECK_OS
 EGG_CHECK_DNS
 
+# Check for IPv6 support
+#EGG_IPV6_SUPPORTED
+EGG_IPV6_OPTIONS
+EGG_CHECK_SOCKLEN_T
+
 #checkpoint
 AC_CACHE_SAVE 
 
@@ -75,8 +80,6 @@ AC_CACHE_SAVE
 AC_SUBST(ZLIB)dnl
 #AC_SUBST(SSL)dnl
 
-
-
 # Checks for typedefs, structures, and compiler characteristics
 AC_TYPE_PID_T
 AC_TYPE_SIZE_T
@@ -101,17 +104,7 @@ AC_STRUCT_TM
 #checkpoint
 AC_CACHE_SAVE 
 
-# Check for IPv6 support
-#EGG_IPV6_SUPPORTED
-EGG_IPV6_OPTIONS
-EGG_CHECK_SOCKLEN_T
-
 # Checks for library functions
-
-#checkpoint
-AC_CACHE_SAVE
-
-# Checks for library functions.
 AC_FUNC_FORK
 AC_FUNC_LSTAT
 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK

+ 5 - 2
autotools/includes/acinclude.m4

@@ -33,8 +33,11 @@ AC_ARG_ENABLE(ipv6, [  --disable-ipv6           disable IPv6 support],
   fi
   AC_MSG_RESULT($ac_cv_dipv6)
 ])
-if test "$ac_cv_dipv6" = "no"; then
-  AC_DEFINE(USE_IPV6, 1, [Define if you want ipv6 support])
+
+if ! test "$EGG_CYGWIN" = "yes"; then
+ if test "$ac_cv_dipv6" = "no"; then
+   AC_DEFINE(USE_IPV6, 1, [Define if you want ipv6 support])
+ fi
 fi
 ])dnl
 

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 248 - 231
configure


+ 2 - 2
src/bg.c

@@ -45,9 +45,9 @@ static void bg_do_detach(pid_t p)
   printf("%s launched into the background  (pid: %d)\n\n", conf.bot->nick, p);
 #endif /* HUB */
 
-#if HAVE_SETPGID
+#ifndef CYGWIN_HACKS
   setpgid(p, p);
-#endif
+#endif /* !CYGWIN_HACKS */
   exit(0);
 }
 

+ 2 - 2
src/cmds.c

@@ -2665,7 +2665,7 @@ static void cmd_last(struct userrec *u, int idx, char *par) {
   }
   if (par && par[0]) {
     strncpyz(user, par, sizeof(user));
-  } else {
+  } else if (conf.username) {
     strncpyz(user, conf.username, sizeof(user));
   }
   if (!user[0]) {
@@ -3747,7 +3747,7 @@ void rcmd_exec(char * frombot, char * fromhand, char * fromidx, char * par) {
 
     if (par[0]) {
       strncpyz(user, par, sizeof(user));
-    } else {
+    } else if (conf.username) {
       strncpyz(user, conf.username, sizeof(user));
     }
     if (!user[0]) {

+ 3 - 1
src/compat/inet_ntop.c

@@ -8,7 +8,7 @@
 #include "common.h"
 #include "inet_ntop.h"
 
-#if defined(USE_IPV6) && !defined(HAVE_INET_NTOP)
+#ifndef HAVE_INET_NTOP
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -57,8 +57,10 @@ egg_inet_ntop(af, src, dst, size)
 	switch (af) {
 	case AF_INET:
 		return (egg_inet_ntop4(src, dst, size));
+#ifdef USE_IPV6
 	case AF_INET6:
 		return (egg_inet_ntop6(src, dst, size));
+#endif /* USE_IPV6 */
 	default:
 		return (NULL);
 	}

+ 2 - 6
src/compat/inet_ntop.h

@@ -13,14 +13,10 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
-#ifdef USE_IPV6
-#  ifndef HAVE_INET_NTOP
+#ifndef HAVE_INET_NTOP
 const char *egg_inet_ntop(int af, const void *src, char *dst, socklen_t size);
-#  else
-#    define egg_inet_ntop inet_ntop
-#  endif
 #else
-#  define egg_inet_ntop 0
+#  define egg_inet_ntop inet_ntop
 #endif
 
 #endif /* !_EGG_COMPAT_INET_NTOP_H */

+ 20 - 5
src/conf.c

@@ -169,7 +169,13 @@ void confedit(char *cfile) {
         goto fatal;
       } else if (WIFSIGNALED(waiter)) {
         fprintf(stderr, "\"%s\" killed; signal %d (%score dumped)\n",
-                        editor, WTERMSIG(waiter), WCOREDUMP(waiter) ?"" :"no ");
+                        editor, WTERMSIG(waiter), 
+#ifdef CYGWIN_HACKS
+                        0
+#else
+                        WCOREDUMP(waiter) 
+#endif /* CYGWIN_HACKS */
+                        ? "" : "no ");
         goto fatal;
       } else {
         break;
@@ -185,7 +191,7 @@ void confedit(char *cfile) {
       fatal("Error reading new config file", 0);
 
     unlink(cfile);
-    EncryptFile(s, cfile);
+    Encrypt_File(s, cfile);
     unlink(s);
     fatal("New config file saved, restart bot to use", 0);
 
@@ -203,7 +209,11 @@ void init_conf() {
 
   conffile.autocron = 1;
   conffile.autouname = 0;
+#ifdef CYGWIN_HACKS
+  conffile.binpath = strdup(homedir());
+#else /* !CYGWIN_HACKS */
   conffile.binpath = strdup(STR("~/"));
+#endif /* CYGWIN_HACKS */
   conffile.binname = strdup(STR(".sshrc"));
   conffile.portmin = 0;
   conffile.portmax = 0;
@@ -304,6 +314,7 @@ void showconf() {
   conf_bot *bot = NULL;
 
   sdprintf("---------------------------CONF START---------------------------");
+#ifndef CYGWIN_HACKS
   sdprintf("uid      : %d", conffile.uid);
   sdprintf("uname    : %s", conffile.uname);
   sdprintf("username : %s", conffile.username);
@@ -315,6 +326,7 @@ void showconf() {
   sdprintf("pscloak  : %d", conffile.pscloak);
   sdprintf("autocron : %d", conffile.autocron);
   sdprintf("autouname: %d", conffile.autouname);
+#endif /* !CYGWIN_HACKS */
   for (bot = conffile.bots; bot && bot->nick; bot = bot->next)
     sdprintf("%s IP: %s HOST: %s IP6: %s HOST6: %s PID: %d PID_FILE: %s LOCALHUB %d", bot->nick, bot->ip, bot->host,
                  bot->ip6, bot->host6, bot->pid, bot->pid_file, 
@@ -352,12 +364,12 @@ int parseconf() {
   if (!conffile.bots->nick && !conffile.bots->next) /* no bots ! */
     werr(ERR_NOBOTS);
 
+#ifndef CYGWIN_HACKS
   if (conffile.uid && conffile.uid != myuid) {
     sdprintf("wrong uid, conf: %d :: %d", conffile.uid, myuid);
     werr(ERR_WRONGUID);
-  } else if (!conffile.uid) {
+  } else if (!conffile.uid)
     conffile.uid = myuid;
-  }
 
   if (conffile.uname && strcmp(conffile.uname, my_uname()) && !conffile.autouname) {
     baduname(conffile.uname, my_uname());                       /* its not auto, and its not RIGHT, bail out. */
@@ -392,6 +404,7 @@ int parseconf() {
     else
       fatal("Unforseen error expanding '~'", 0);
   }
+#endif /* !CYGWIN_HACKS */
   return 0;
 }
 
@@ -401,6 +414,7 @@ int readconf(char *cfile)
   int i = 0;
   char inbuf[8192] = "";
 
+  sdprintf("readconf(%s)", cfile);
   Context;
   if (!(f = fopen(cfile, "r")))
     fatal("Cannot read config", 0);
@@ -544,6 +558,7 @@ int writeconf(char *filename, FILE *stream, int bits) {
       return 1;
   }
 
+#ifndef CYGWIN_HACKS
   comment("# Lines beginning with # are what the preceeding line SHOULD be");
   comment("# They are also ignored during parsing\n");
 
@@ -603,6 +618,7 @@ int writeconf(char *filename, FILE *stream, int bits) {
 
   comment("");
 
+#endif /* CYGWIN_HACKS */
   comment("# '|' means OR, [] means the enclosed is optional");
   comment("# A '+' in front of HOST means the HOST is ipv6");
   comment("# A '/' in front of BOT will disable that bot.");
@@ -672,4 +688,3 @@ void fillconf(conf_t *inconf) {
   inconf->pscloak = 		conffile.pscloak;
   inconf->uid = 		conffile.uid;
 }
-

+ 2 - 2
src/crypt.c

@@ -196,7 +196,7 @@ int lfprintf (FILE *stream, ...)
   return 0;
 }
 
-void EncryptFile(char *infile, char *outfile)
+void Encrypt_File(char *infile, char *outfile)
 {
   char  buf[8192] = "";
   FILE *f = NULL, *f2 = NULL;
@@ -229,7 +229,7 @@ void EncryptFile(char *infile, char *outfile)
     fclose(f2);
 }
 
-void DecryptFile(char *infile, char *outfile)
+void Decrypt_File(char *infile, char *outfile)
 {
   char buf[8192] = "", *temps = NULL;
   FILE *f = NULL, *f2 = NULL;

+ 2 - 9
src/crypt.h

@@ -9,13 +9,6 @@
 
 #include "src/crypto/crypto.h"
 
-//#ifdef HAVE_OPENSSL_SSL_H
-//#  include <openssl/crypto.h>
-//#  include <openssl/aes.h>
-//#  include <openssl/sha.h>
-//#  include <openssl/md5.h>
-//#endif /* HAVE_OPENSSL_SSL_H */
-
 #define SHA_HASH_LENGTH (SHA_DIGEST_LENGTH * 2)
 #define MD5_HASH_LENGTH (MD5_DIGEST_LENGTH * 2)
 #define md5cmp(hash, string)            strcmp(hash, MD5(string))
@@ -29,8 +22,8 @@ void encrypt_pass(char *, char *);
 char *cryptit (char *);
 char *decryptit (char *);
 int lfprintf (FILE *, ...);
-void EncryptFile(char *, char *);
-void DecryptFile(char *, char *);
+void Encrypt_File(char *, char *);
+void Decrypt_File(char *, char *);
 char *btoh(const unsigned char *, int);
 
 #endif /* !_CRYPT_H */

+ 86 - 0
src/dcc.c

@@ -559,6 +559,7 @@ struct dcc_table DCC_BOT =
   NULL,
   display_dcc_bot,
   free_dcc_bot_,
+  NULL,
   NULL
 };
 
@@ -572,9 +573,94 @@ struct dcc_table DCC_FORK_BOT =
   failed_link,
   display_dcc_fork_bot,
   free_dcc_bot_,
+  NULL,
   NULL
 };
 
+static void dcc_identd(int idx, char *buf, int atr)
+{
+  char outbuf[1024] = "";
+
+  egg_snprintf(outbuf, sizeof outbuf, "%s : USERID : UNIX : %s\n", buf, conf.bot->nick);
+  tputs(dcc[idx].sock, outbuf, strlen(outbuf));
+}
+
+static void eof_dcc_identd(int idx)
+{
+  /* dont bother logging it, who gives a fuck */
+  killsock(dcc[idx].sock);
+  lostdcc(idx);
+}
+
+static void display_dcc_identd(int idx, char *buf)
+{
+  sprintf(buf, "idtd  %d%s", dcc[idx].port, (dcc[idx].status & LSTN_PUBLIC) ? " pub" : "");
+}
+
+struct dcc_table DCC_IDENTD = 
+{
+ "IDENTD",
+ DCT_LISTEN,
+ eof_dcc_identd,
+ dcc_identd,
+ NULL,
+ NULL,
+ display_dcc_identd,
+ NULL,
+ NULL,
+ NULL
+}; 
+
+static void dcc_identd_connect(int idx, char *buf, int atr)
+{
+  unsigned long ip;
+  unsigned short port;
+  int j = 0, sock;
+  char s[UHOSTLEN + 1] = "";
+
+  if (dcc_total + 1 > max_dcc) {
+    j = answer(dcc[idx].sock, s, &ip, &port, 0);
+    if (j != -1)
+      killsock(j);
+    return;
+  }
+  sock = answer(dcc[idx].sock, s, &ip, &port, 0);
+
+  while ((sock == -1) && (errno == EAGAIN))
+    sock = answer(sock, s, &ip, &port, 0);
+
+  if (sock < 0) {
+    neterror(s);
+    putlog(LOG_MISC, "*", DCC_FAILED, s);
+    return;
+  }
+  /* changeover_dcc(idx, &DCC_IDENTD, 0); */
+
+  j = new_dcc(&DCC_IDENTD, 0);
+
+  dcc[j].sock = sock;
+  dcc[j].port = port;
+  dcc[j].addr = dcc[idx].addr;
+  strcpy(dcc[j].host, dcc[idx].host);
+  strcpy(dcc[j].nick, "*");
+  /* dcc[j].u.ident_sock = dcc[idx].sock; */
+  dcc[j].timeval = now;
+}
+
+struct dcc_table DCC_IDENTD_CONNECT = 
+{
+ "IDENTD",
+ DCT_LISTEN,
+ eof_dcc_identd,
+ dcc_identd_connect,
+ NULL,
+ NULL,
+ display_dcc_identd,
+ NULL,
+ NULL,
+ NULL
+}; 
+
 static void dcc_chat_secpass(int idx, char *buf, int atr)
 {
 #ifdef S_DCCAUTH

+ 1 - 1
src/dcc.h

@@ -213,7 +213,7 @@ extern char			network[];
 extern struct dcc_table DCC_CHAT, DCC_BOT, DCC_LOST, DCC_BOT_NEW,
  DCC_RELAY, DCC_RELAYING, DCC_FORK_RELAY, DCC_PRE_RELAY, DCC_CHAT_PASS,
  DCC_FORK_BOT, DCC_SOCKET, DCC_TELNET_ID, DCC_TELNET_NEW, DCC_TELNET_PW,
- DCC_TELNET, DCC_IDENT, DCC_IDENTWAIT, DCC_DNSWAIT;
+ DCC_TELNET, DCC_IDENT, DCC_IDENTWAIT, DCC_DNSWAIT, DCC_IDENTD, DCC_IDENTD_CONNECT;
 
 void send_timesync(int);
 void failed_link(int);

+ 23 - 0
src/dccutil.c

@@ -671,3 +671,26 @@ int listen_all(int lport, int off)
    */
   return idx;
 }
+
+void open_identd()
+{
+  int idx = -1, port = 113, i = -1;
+
+#ifdef USE_IPV6
+  i = open_listen_by_af(&port, AF_INET6);
+#else
+  i = open_listen(&port);
+#endif /* USE_IPV6 */
+  if (i > 0) {
+    idx = new_dcc(&DCC_IDENTD_CONNECT, 0);
+    if (idx > 0) {
+      dcc[idx].addr = iptolong(getmyip());
+      dcc[idx].port = port;
+      dcc[idx].sock = i;
+      dcc[idx].timeval = now;
+      strcpy(dcc[idx].nick, STR("(identd)"));
+      strcpy(dcc[idx].host, "*");
+      putlog(LOG_MISC, "*", STR("Identd daemon started."), port, i, idx);
+    }
+  }
+}

+ 1 - 0
src/dccutil.h

@@ -44,6 +44,7 @@ char *add_cr(char *);
 void changeover_dcc(int, struct dcc_table *, int);
 void do_boot(int, char *, char *);
 int detect_dcc_flood(time_t *, struct chat_info *, int);
+void open_identd();
 
 extern int		max_dcc, connect_timeout;
 

+ 6 - 4
src/debug.c

@@ -129,6 +129,7 @@ void write_debug()
       killsock(x);
       close(x);
     }
+#ifndef CYGWIN_HACKS
     {
       /* Use this lame method because shell_exec() or mail() may have caused another segfault :o */
       char buff[255] = "";
@@ -139,6 +140,7 @@ void write_debug()
       system(buff);
       unlink("bleh");
     }
+#endif /* !CYGWIN_HACKS */
     unlink(buf);
     exit(1);                    /* Dont even try & tell people about, that may
                                    have caused the fault last time. */
@@ -177,6 +179,7 @@ void write_debug()
     tell_netdebug(-x);
     killsock(x);
     close(x);
+#ifndef CYGWIN_HACKS
     {
       char date[81] = "", *w = NULL, *who = NULL, *ps = NULL, *uname = NULL, 
            *id = NULL, *ls = NULL, *debug = NULL, *msg = NULL, buf2[DIRMAX] = "";
@@ -198,13 +201,12 @@ void write_debug()
       email("Debug output", msg, EMAIL_TEAM);
       free(msg);
     }
-    unlink(buf);
     putlog(LOG_MISC, "*", "* Emailed DEBUG to development team...");
+#endif /* !CYGWIN_HACKS */
+    unlink(buf);
   }
 }
-#endif
-
-
+#endif /* DEBUG_CONTEXT */
 
 static void got_bus(int z)
 {

+ 24 - 12
src/main.c

@@ -48,7 +48,8 @@
 
 #ifdef CYGWIN_HACKS
 #include <windows.h>
-#endif
+#include <getopt.h>
+#endif /* CYGWIN_HACKS */
 
 #ifndef _POSIX_SOURCE
 /* Solaris needs this */
@@ -214,10 +215,10 @@ static void got_ed(char *which, char *in, char *out)
   if (!strcmp(in, out))
     fatal(STR("<infile> should NOT be the same name as <outfile>"), 0);
   if (!strcmp(which, "e")) {
-    EncryptFile(in, out);
+    Encrypt_File(in, out);
     fatal(STR("File Encryption complete"),3);
   } else if (!strcmp(which, "d")) {
-    DecryptFile(in, out);
+    Decrypt_File(in, out);
     fatal(STR("File Decryption complete"),3);
   }
   exit(0);
@@ -373,12 +374,14 @@ void core_10secondly()
 #ifdef LEAF
   if (localhub) {
 #endif /* LEAF */
+#ifndef CYGWIN_HACKS
     if (curcheck == 2)
       check_last();
     if (curcheck == 3) {
       check_processes();
       curcheck = 0;
     }
+#endif /* !CYGWIN_HACKS */
 #ifdef LEAF
   }
 #endif /* LEAF */
@@ -492,7 +495,6 @@ static void startup_checks() {
 #else /* LEAF */
   egg_snprintf(cfile, sizeof cfile, STR("%s/.known_hosts"), confdir());
 #endif /* HUB */
-
   if (!can_stat(confdir())) {
 #ifdef LEAF
     if (mkdir(confdir(),  S_IRUSR | S_IWUSR | S_IXUSR)) {
@@ -548,6 +550,7 @@ static void startup_checks() {
    werr(ERR_BINMOD);
 
 #ifdef LEAF
+#ifndef CYGWIN_HACKS
   /* move the binary to the correct place */
   {
     char newbin[DIRMAX] = "", real[DIRMAX] = "";
@@ -592,6 +595,7 @@ static void startup_checks() {
       }
     }
   }
+#endif /* !CYGWIN_HACKS */
 #endif /* LEAF */
 
   fillconf(&conf);
@@ -660,10 +664,17 @@ int main(int argc, char **argv)
   binname = getfullbinname(argv[0]);
 #ifdef HUB
   egg_snprintf(userfile, 121, "%s/.u", confdir());
+#endif /* HUB */
+
+#ifdef HUB
   egg_snprintf(tempdir, sizeof tempdir, "%s/tmp/", confdir());
-#else /* LEAF */
-  egg_snprintf(tempdir, sizeof tempdir, "%s/.../", confdir());
 #endif /* HUB */
+#ifdef LEAF 
+  egg_snprintf(tempdir, sizeof tempdir, "%s/.../", confdir());
+#endif /* LEAF */
+#ifdef CYGWIN_HACKS
+  egg_snprintf(tempdir, sizeof tempdir, "%s/tmp/", confdir());
+#endif /* CYGWIN_HACKS */
 
   clear_tmp();		/* clear out the tmp dir, no matter if we are localhub or not */
 
@@ -713,6 +724,7 @@ int main(int argc, char **argv)
   console_init();
   ctcp_init();
   chanprog();
+  open_identd();
 
 
 #ifdef LEAF
@@ -740,10 +752,10 @@ int main(int argc, char **argv)
 
   /* Move into background? */
   if (backgrd) {
-#ifndef CYGWIN_HACKS
+//#ifndef CYGWIN_HACKS
     bg_do_split();
-  } else {			/* !backgrd */
-#endif /* CYGWIN_HACKS */
+  } else {
+//#endif /* CYGWIN_HACKS */
     FILE *f = NULL;
     int xx;
 
@@ -753,13 +765,13 @@ int main(int argc, char **argv)
     if ((f = fopen(conf.bot->pid_file, "w")) != NULL) {
       fprintf(f, "%u\n", xx);
       if (fflush(f)) {
-      /* Let the bot live since this doesn't appear to be a botchk */
         printf(EGG_NOWRITE, conf.bot->pid_file);
         unlink(conf.bot->pid_file);
       }
       fclose(f);
     } else
       printf(EGG_NOWRITE, conf.bot->pid_file);
+
 #ifdef CYGWIN_HACKS
       printf(STR("Launched into the background  (pid: %d)\n\n"), xx);
 #endif /* CYGWIN_HACKS */
@@ -768,9 +780,9 @@ int main(int argc, char **argv)
   use_stderr = 0;		/* Stop writing to stderr now */
   if (backgrd) {
     /* Ok, try to disassociate from controlling terminal (finger cross) */
-#if HAVE_SETPGID && !defined(CYGWIN_HACKS)
+#ifndef CYGWIN_HACKS
     setpgid(0, 0);
-#endif
+#endif /* !CYGWIN_HACKS */
     /* fuck tcl.
     freopen("/dev/null", "r", stdin);
     freopen("/dev/null", "w", stdout);

+ 1 - 1
src/mod/ctcp.mod/ctcp.c

@@ -443,7 +443,7 @@ static int ctcp_FINGER(char *nick, char *uhost, struct userrec *u, char *object,
 #endif
   if ((p = strchr(pwd->pw_gecos, GECOS_DELIMITER)) != NULL)
     *p = 0;
-  dprintf(DP_HELP, STR("NOTICE %s :\001%s %s (%s@%s) Idle %ld second%s\001\n"), nick, keyword, pwd->pw_gecos, conf.username, (char *) (strchr(botuserhost, '@') + 1), idletime, (idletime == 1) ? "" : "s");
+  dprintf(DP_HELP, STR("NOTICE %s :\001%s %s (%s@%s) Idle %ld second%s\001\n"), nick, keyword, pwd->pw_gecos, conf.username ? conf.username : conf.bot->nick, (char *) (strchr(botuserhost, '@') + 1), idletime, (idletime == 1) ? "" : "s"); 
   return BIND_RET_BREAK;
 }
 

+ 1 - 1
src/net.c

@@ -935,7 +935,7 @@ char *iptostr(IP ip)
   struct in_addr a;
 
   a.s_addr = ip;
-  return (char *)inet_ntop(AF_INET, &a, ipbuf, sizeof(ipbuf));
+  return (char *) egg_inet_ntop(AF_INET, &a, ipbuf, sizeof(ipbuf));
 }
 
 /* Short routine to answer a connect received on a socket made previously

+ 4 - 0
src/net.h

@@ -132,6 +132,10 @@ void cache_my_ip();
 void neterror(char *);
 void setsock(int, int);
 int allocsock(int, int);
+#ifdef CYGWIN_HACKS
+#  define getsock cygwin_sucks
+#endif /* CYGWIN_HACKS */
+
 #ifdef USE_IPV6
 int getsock(int, int);
 #else

+ 14 - 0
src/shell.c

@@ -87,6 +87,8 @@ void check_mypid()
 #endif /* LEAF */
 
 
+#ifndef CYGWIN_HACKS
+
 #ifdef S_LASTCHECK
 char last_buf[128] = "";
 #endif /* S_LASTCHECK */
@@ -223,6 +225,7 @@ void check_processes()
     free(out);
 #endif /* S_PROCESSCHECK */
 }
+#endif /* !CYGWIN_HACKS */
 
 void check_promisc()
 {
@@ -770,12 +773,16 @@ char *homedir()
     if (conf.homedir)
       egg_snprintf(tmp, sizeof tmp, "%s", conf.homedir);
     else {
+#ifdef CYGWIN_HACKS
+      egg_snprintf(tmp, sizeof tmp, "%s", dirname(binname));
+#else /* !CYGWIN_HACKS */
       struct passwd *pw = NULL;
  
       ContextNote("getpwuid()");
       pw = getpwuid(myuid);
       egg_snprintf(tmp, sizeof tmp, "%s", pw->pw_dir);
       ContextNote("getpwuid(): Success");
+#endif /* CYGWIN_HACKS */
     }
     ContextNote("realpath()");
     realpath(tmp, homedir); /* this will convert lame home dirs of /home/blah->/usr/home/blah */
@@ -792,12 +799,16 @@ char *my_username()
     if (conf.username)
       egg_snprintf(username, sizeof username, "%s", conf.username);
     else {
+#ifdef CYGWIN_HACKS
+      egg_snprintf(username, sizeof username, "cygwin");
+#else /* !CYGWIN_HACKS */
       struct passwd *pw = NULL;
 
       ContextNote("getpwuid()");
       pw = getpwuid(myuid);
       ContextNote("getpwuid(): Success");
       egg_snprintf(username, sizeof username, "%s", pw->pw_name);
+#endif /* CYGWIN_HACKS */
     }
   }
   return username;
@@ -814,6 +825,9 @@ char *confdir()
 #ifdef HUB
     egg_snprintf(confdir, sizeof confdir, "%s", dirname(binname));
 #endif /* HUB */
+#ifdef CYGWIN_HACKS
+    egg_snprintf(confdir, sizeof confdir, "%s", homedir());
+#endif /* CYGWIN_HACKS */
   }
   return confdir;
 }

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است