gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r18624 - in gnunet: . src/nat


From: gnunet
Subject: [GNUnet-SVN] r18624 - in gnunet: . src/nat
Date: Fri, 16 Dec 2011 12:16:27 +0100

Author: grothoff
Date: 2011-12-16 12:16:26 +0100 (Fri, 16 Dec 2011)
New Revision: 18624

Modified:
   gnunet/configure.ac
   gnunet/src/nat/gnunet-helper-nat-server.c
Log:
some very minor stylistic changes to gnunet-helper-nat-server based on 
suggestions from Jacob Applebaum

Modified: gnunet/configure.ac
===================================================================
--- gnunet/configure.ac 2011-12-15 18:44:52 UTC (rev 18623)
+++ gnunet/configure.ac 2011-12-16 11:16:26 UTC (rev 18624)
@@ -625,7 +625,7 @@
 AC_HEADER_SYS_WAIT
 AC_TYPE_OFF_T
 AC_TYPE_UID_T
-AC_CHECK_FUNCS([floor gethostname memmove rmdir strncasecmp strrchr strtol 
atoll dup2 fdatasync ftruncate gettimeofday memset mkdir mkfifo select socket 
strcasecmp strchr strdup strerror strstr clock_gettime getrusage rand uname 
setlocale getcwd mktime gmtime_r gmtime strlcpy strlcat ftruncate stat64 sbrk 
mmap mremap setrlimit sysconf gethostbyaddr initgroups getifaddrs freeifaddrs 
getnameinfo getaddrinfo inet_ntoa localtime_r nl_langinfo putenv realpath 
strndup gethostbyname2 gethostbyname getpeerucred getpeereid])
+AC_CHECK_FUNCS([floor gethostname memmove rmdir strncasecmp strrchr strtol 
atoll dup2 fdatasync ftruncate gettimeofday memset mkdir mkfifo select socket 
strcasecmp strchr strdup strerror strstr clock_gettime getrusage rand uname 
setlocale getcwd mktime gmtime_r gmtime strlcpy strlcat ftruncate stat64 sbrk 
mmap mremap setrlimit sysconf gethostbyaddr initgroups getifaddrs freeifaddrs 
getnameinfo getaddrinfo inet_ntoa localtime_r nl_langinfo putenv realpath 
strndup gethostbyname2 gethostbyname getpeerucred getpeereid setresuid])
 
 # restore LIBS
 LIBS=$SAVE_LIBS

Modified: gnunet/src/nat/gnunet-helper-nat-server.c
===================================================================
--- gnunet/src/nat/gnunet-helper-nat-server.c   2011-12-15 18:44:52 UTC (rev 
18623)
+++ gnunet/src/nat/gnunet-helper-nat-server.c   2011-12-16 11:16:26 UTC (rev 
18624)
@@ -472,7 +472,7 @@
 
 
 /**
- * Create a UDP socket for writinging.
+ * Create a UDP socket for writing.
  *
  * @param my_ip source address (our ip address)
  * @return -1 on error
@@ -501,7 +501,8 @@
   {
     fprintf (stderr, "Error binding UDP socket to port %u: %s\n", 
NAT_TRAV_PORT,
              strerror (errno));
-    /* likely problematic, but not certain, try to continue */
+    close (ret);
+    return -1;
   }
   return ret;
 }
@@ -539,19 +540,27 @@
   if (-1 == (rawsock = make_raw_socket ()))
   {
     close (icmpsock);
-    return 3;
+    return 4;
   }
   uid = getuid ();
+#ifdef HAVE_SETRESUID
   if (0 != setresuid (uid, uid, uid))
   {
     fprintf (stderr, "Failed to setresuid: %s\n", strerror (errno));
-    /* not critical, continue anyway */
+    return 5;
   }
+#else
+  if (0 != (setuid (uid) | seteuid (uid)))
+  {
+    fprintf (stderr, "Failed to setuid: %s\n", strerror (errno));
+    return 6;
+  }
+#endif
   if (-1 == (udpsock = make_udp_socket (&external)))
   {
     close (icmpsock);
     close (rawsock);
-    return 3;
+    return 7;
   }
   alt = 0;
   while (1)
@@ -580,7 +589,7 @@
   close (icmpsock);
   close (rawsock);
   close (udpsock);
-  return 4;
+  return 8;
 }
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]