SCO 'su' replacement
Eamonn McManus
em at dce.ie
Tue Apr 30 05:53:44 AEST 1991
On 11th April I reposted our replacement su for SCO Unix. I am grateful
to Jan-Piet Mens for pointing out that it did not successfully set the
login-uid (which is its main raison d'etre) on 3.2.2, and for helping me
try out replacements. This patch produces a version that works properly
on both 3.2.0 and 3.2.2.
,
Eamonn
*** /tmp/,RCSt1a18137 Mon Apr 29 20:49:01 1991
--- oksetluid.c Mon Apr 29 20:44:57 1991
***************
*** 9,15 ****
#ifndef lint
static const char rcsid[] =
! "$Id: oksetluid.c,v 1.1 90/09/28 16:21:11 em Release $";
#endif
#include <fcntl.h>
--- 9,15 ----
#ifndef lint
static const char rcsid[] =
! "$Id: oksetluid.c,v 1.2 91/04/29 20:44:21 em Release $";
#endif
#include <fcntl.h>
***************
*** 34,40 ****
struct security_info *secp;
long secpaddr;
int fd, i;
! char *err=0;
if (!setluid(id)) return 0;
uxnlist(nlsym);
if (!(secpaddr = nlsym[0].n_value) )
--- 34,40 ----
struct security_info *secp;
long secpaddr;
int fd, i;
! char *err=0, zero=0;
if (!setluid(id)) return 0;
uxnlist(nlsym);
if (!(secpaddr = nlsym[0].n_value) )
***************
*** 48,58 ****
else {
/* Stupid definition of offsetof() in <stddef.h> produces warning from
Microsoft compiler. */
! i = (long) secp + offsetof(struct security_info, si_luid);
if (lseek(fd, (long) i, 0) != i)
err = "Can't seek to info in /dev/kmem";
! else if (write(fd, &id, sizeof(id)) != sizeof(id))
! err = "Can't write luid to /dev/kmem";
}
close(fd);
return err;
--- 48,60 ----
else {
/* Stupid definition of offsetof() in <stddef.h> produces warning from
Microsoft compiler. */
! i = (long) secp + offsetof(struct security_info, si_luid_set);
if (lseek(fd, (long) i, 0) != i)
err = "Can't seek to info in /dev/kmem";
! else if (write(fd, &zero, sizeof(zero)) != sizeof(zero))
! err = "Can't write luid_set to /dev/kmem";
! else if (setluid(id) < 0)
! err = "Setluid failed";
}
close(fd);
return err;
*** /tmp/,RCSt1a18137 Mon Apr 29 20:49:04 1991
--- su.c Mon Apr 29 20:45:18 1991
***************
*** 29,35 ****
#ifndef lint
static const char rcsid[] =
! "$Id: su.c,v 1.1 90/09/28 16:22:21 em Release $";
#endif
#ifndef SecureWare
--- 29,35 ----
#ifndef lint
static const char rcsid[] =
! "$Id: su.c,v 1.2 91/04/29 20:44:58 em Release $";
#endif
#ifndef SecureWare
***************
*** 261,267 ****
if (islogin && chdir(pwd->pw_dir) < 0)
perror(pwd->pw_dir); /* But su anyway. */
execv(shell, shargs);
! crash("execl", shell);
}
--- 261,267 ----
if (islogin && chdir(pwd->pw_dir) < 0)
perror(pwd->pw_dir); /* But su anyway. */
execv(shell, shargs);
! crash("execv", shell);
}
More information about the Alt.sources.d
mailing list