LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File ppp-2.4.3-winbind-setuidfix.patch of Package ppp (Project network)

--- pppd/plugins/winbind.c
+++ pppd/plugins/winbind.c
@@ -296,16 +296,23 @@
 
 	if (forkret == 0) {
 		/* child process */
-		uid_t uid;
+		uid_t uid = getuid();
 
 		close(child_out[0]);
 		close(child_in[1]);
 
 		/* run winbind as the user that invoked pppd */
 		setgid(getgid());
-		uid = getuid();
 		if (setuid(uid) == -1 || getuid() != uid)
+		{
 			fatal("pppd/winbind: could not setuid to %d: %m", uid);
+			exit(1);
+		}
+		if (getuid() != uid) {
+                       perror("pppd/winbind: could not setuid to orig uid");
+                       exit(1);
+                }
+
 		execl("/bin/sh", "sh", "-c", ntlm_auth, NULL);  
 		fatal("pppd/winbind: could not exec /bin/sh: %m");
 	}