diff options
author | Ralph Turner - Sun UK - Contractor <Ralph.Turner@Sun.COM> | 2010-05-27 10:20:25 +0100 |
---|---|---|
committer | Ralph Turner - Sun UK - Contractor <Ralph.Turner@Sun.COM> | 2010-05-27 10:20:25 +0100 |
commit | 05f9a513b6ce84a1c8ebdc256737b1e8bd5ea049 (patch) | |
tree | b90d0e33754ac5579670ccba7fc6f75dd1e9b2e4 /usr/src/cmd/print/bsd-sysv-commands/lp.c | |
parent | 05b58617e776d05dc8fc4d3d4966d9a05ebf1da0 (diff) | |
download | illumos-joyent-05f9a513b6ce84a1c8ebdc256737b1e8bd5ea049.tar.gz |
6925888 printer job submitted via suid program
Diffstat (limited to 'usr/src/cmd/print/bsd-sysv-commands/lp.c')
-rw-r--r-- | usr/src/cmd/print/bsd-sysv-commands/lp.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/usr/src/cmd/print/bsd-sysv-commands/lp.c b/usr/src/cmd/print/bsd-sysv-commands/lp.c index 5c8b877ca4..46ef3cf665 100644 --- a/usr/src/cmd/print/bsd-sysv-commands/lp.c +++ b/usr/src/cmd/print/bsd-sysv-commands/lp.c @@ -34,7 +34,9 @@ #include <libintl.h> #include <papi.h> #include "common.h" - +#include <pwd.h> +#include <grp.h> +#include <sys/types.h> #ifdef HAVE_LIBMAGIC /* for mimetype auto-detection */ #include <magic.h> #endif /* HAVE_LIBMAGIC */ @@ -77,10 +79,18 @@ main(int ac, char *av[]) int validate = 0; int modify = -1; int c; + uid_t ruid; + struct passwd *pw; (void) setlocale(LC_ALL, ""); (void) textdomain("SUNW_OST_OSCMD"); + ruid = getuid(); + if ((pw = getpwuid(ruid)) != NULL) + (void) initgroups(pw->pw_name, pw->pw_gid); + (void) setuid(ruid); + + while ((c = getopt(ac, av, "DEH:P:S:T:cd:f:i:mn:o:pq:rst:Vwy:")) != EOF) switch (c) { case 'H': /* handling */ |