uwrap: Move the EINVAL check down in seteuid()
authorAndreas Schneider <asn@samba.org>
Fri, 30 Oct 2015 12:39:30 +0000 (13:39 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 5 Nov 2015 08:23:16 +0000 (09:23 +0100)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/uid_wrapper/uid_wrapper.c

index e0d84beb7ea7769c611deee085a560d00f61b41b..dd999ffc11453fae59e39b47b320059ad822545b 100644 (file)
@@ -1293,15 +1293,16 @@ int setuid(uid_t uid)
 #ifdef HAVE_SETEUID
 int seteuid(uid_t euid)
 {
+       if (!uid_wrapper_enabled()) {
+               return libc_seteuid(euid);
+       }
+
+       /* On FreeBSD the uid_t -1 is set and doesn't produce and error */
        if (euid == (uid_t)-1) {
                errno = EINVAL;
                return -1;
        }
 
-       if (!uid_wrapper_enabled()) {
-               return libc_seteuid(euid);
-       }
-
        uwrap_init();
        return uwrap_setresuid(-1, euid, -1);
 }