]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/ngircd.c
Added Cygwin uid kludge. (verified working)
[ngircd-alex.git] / src / ngircd / ngircd.c
index bb88b3b97fca68641c04c6095822fa828863346d..d839618fefb8174de42c96fd008318efe6e56cd2 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2007 Alexander Barton (alex@barton.de).
+ * Copyright (c)2001-2008 Alexander Barton (alex@barton.de).
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -12,8 +12,6 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: ngircd.c,v 1.119 2008/03/18 20:12:47 fw Exp $";
-
 /**
  * @file
  * The main program, including the C function main() which is called
@@ -42,7 +40,6 @@ static char UNUSED id[] = "$Id: ngircd.c,v 1.119 2008/03/18 20:12:47 fw Exp $";
 #include "client.h"
 #include "channel.h"
 #include "conf.h"
-#include "cvs-version.h"
 #include "lists.h"
 #include "log.h"
 #include "parse.h"
@@ -412,12 +409,9 @@ Fill_Version( void )
        strlcat( NGIRCd_VersionAddition, "/", sizeof( NGIRCd_VersionAddition ));
        strlcat( NGIRCd_VersionAddition, TARGET_OS, sizeof( NGIRCd_VersionAddition ));
 
-#ifdef CVSDATE
-       snprintf( NGIRCd_Version, sizeof NGIRCd_Version,"%s %s(%s)-%s", PACKAGE_NAME, PACKAGE_VERSION, CVSDATE, NGIRCd_VersionAddition);
-#else
-       snprintf( NGIRCd_Version, sizeof NGIRCd_Version, "%s %s-%s", PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_VersionAddition);
-#endif
-} /* Fill_Version */
+       snprintf(NGIRCd_Version, sizeof NGIRCd_Version, "%s %s-%s",
+                PACKAGE_NAME, PACKAGE_VERSION, NGIRCd_VersionAddition);
+       } /* Fill_Version */
 
 
 /**
@@ -558,7 +552,7 @@ static void
 Show_Version( void )
 {
        puts( NGIRCd_Version );
-       puts( "Copyright (c)2001-2007 Alexander Barton (<alex@barton.de>) and Contributors." );
+       puts( "Copyright (c)2001-2008 Alexander Barton (<alex@barton.de>) and Contributors." );
        puts( "Homepage: <http://ngircd.barton.de/>\n" );
        puts( "This is free software; see the source for copying conditions. There is NO" );
        puts( "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." );
@@ -677,6 +671,19 @@ NGIRCd_getNobodyID(uid_t *uid, gid_t *gid )
 {
        struct passwd *pwd;
 
+#ifdef __CYGWIN__
+       /* Cygwin kludge.
+        * It can return EINVAL instead of EPERM
+        * so, if we are already unprivileged,
+        * use id of current user.
+        */
+       if (geteuid() && getuid()) {
+               *uid = getuid();
+               *gid = getgid();
+               return true;
+       }
+#endif
+
        pwd = getpwnam("nobody");
        if (!pwd) return false;