Smbpasswd and setuid

The DJ hartman at mac.com
Thu Oct 18 17:01:11 GMT 2001


I'm trying to create a GUI utility for Samba functions.
It is going to be for MacOS X.

Now to execute commands which require root permissions, Mac OS X allows the
programmer to bring up a login panel, so the user can temporarily login as
another user. I tried to make use of smbpasswd in this way, but I ended up
with this in my programs log:

smbpasswd must *NOT* be setuid root.
(so MacOS X makes it temporarily setuid)

I guess this is a safety precaution in smbpasswd.
If I were to remove this precaution and let my program use the adapted
version, would that be a huge security hole I'm creating?


Is the following the only thing that's preventing me from this?
Or is there more?

if ((geteuid() == (uid_t)0) && (getuid() != (uid_t)0)) {
                fprintf(stderr, "smbpasswd must *NOT* be setuid root.\n");
                exit(1);
        }
}

Everyone with the source could compile a program without this precaution, so
it's more or less a sort of warning, right? Technically there is nothing
preventing me to do so, right?

DJ

---------------------------------------------------------------------------
Universiteit Twente
---------------------------------------------------------------------------
Derk-Jan 'The DJ' Hartman
ICQnr: 10111559
Mail:  mailto:hartman at mac.com
WWW:   http://home.student.utwente.nl/d.hartman/
Goto:  http://www.student.utwente.nl/~macsatcampus





More information about the samba-technical mailing list