diff -urN cups-1.1.7.old/conf/cupsd.conf cups-1.1.7/conf/cupsd.conf --- cups-1.1.7.old/conf/cupsd.conf Fri May 18 16:07:37 2001 +++ cups-1.1.7/conf/cupsd.conf.in Fri May 18 16:50:40 2001 @@ -257,6 +257,9 @@ # default IPP port of 631. It changes users whenever an external # program is run... # +# If you want to set a user different than 'lp', make sure you +# also set the TempDir configuration variable to a user-writable +# directory !! #User lp #Group sys diff -urN cups-1.1.7.old/cups/tempfile.c cups-1.1.7/cups/tempfile.c --- cups-1.1.7.old/cups/tempfile.c Fri May 18 16:07:37 2001 +++ cups-1.1.7/cups/tempfile.c Fri May 18 16:51:07 2001 @@ -82,6 +82,7 @@ #ifdef WIN32 GetTempPath(sizeof(tmpdir), tmpdir); #else + unsetenv("TMPDIR"); if ((tmpdir = getenv("TMPDIR")) == NULL) { /* diff -urN cups-1.1.7.old/pdftops/gfile.cxx cups-1.1.7/pdftops/gfile.cxx --- cups-1.1.7.old/pdftops/gfile.cxx Fri May 18 16:07:39 2001 +++ cups-1.1.7/pdftops/gfile.cxx Fri May 18 16:51:20 2001 @@ -504,6 +504,7 @@ fd = open((*name)->getCString(), O_WRONLY | O_CREAT | O_EXCL, 0600); } else { # if HAVE_MKSTEMP + unsetenv("TMPDIR"); if ((s = getenv("TMPDIR"))) { *name = new GString(s); } else { diff -urN cups-1.1.7.old/scheduler/client.c cups-1.1.7/scheduler/client.c --- cups-1.1.7.old/scheduler/client.c Fri May 18 16:07:38 2001 +++ cups-1.1.7/scheduler/client.c Fri May 18 16:48:45 2001 @@ -2038,6 +2038,11 @@ * Running as root, so change to non-priviledged user... */ + // in modern systems, TMPDIR and TMP equal $HOME/tmp, + // and /root/tmp is of no use for non-root processes + unsetenv("TMPDIR"); + unsetenv("TMP"); + if (setgid(Group)) exit(errno); diff -urN cups-1.1.7.old/scheduler/conf.c cups-1.1.7/scheduler/conf.c --- cups-1.1.7.old/scheduler/conf.c Fri May 18 16:07:38 2001 +++ cups-1.1.7/scheduler/conf.c Fri May 18 16:49:08 2001 @@ -232,6 +232,7 @@ strcpy(RIPCache, "8m"); + unsetenv("TMPDIR"); if (getenv("TMPDIR") == NULL) strcpy(TempDir, CUPS_REQUESTS "/tmp"); else diff -urN cups-1.1.7.old/scheduler/dirsvc.c cups-1.1.7/scheduler/dirsvc.c --- cups-1.1.7.old/scheduler/dirsvc.c Fri May 18 16:07:38 2001 +++ cups-1.1.7/scheduler/dirsvc.c Fri May 18 16:48:45 2001 @@ -899,6 +899,11 @@ * Running as root, so change to non-priviledged user... */ + // in modern systems, TMPDIR and TMP equal $HOME/tmp, + // and /root/tmp is of no use for non-root processes + unsetenv("TMPDIR"); + unsetenv("TMP"); + if (setgid(Group)) exit(errno); diff -urN cups-1.1.7.old/scheduler/job.c cups-1.1.7/scheduler/job.c --- cups-1.1.7.old/scheduler/job.c Fri May 18 16:07:38 2001 +++ cups-1.1.7/scheduler/job.c Fri May 18 16:48:45 2001 @@ -2816,6 +2816,11 @@ * Running as root, so change to non-priviledged user... */ + // in modern systems, TMPDIR and TMP equal $HOME/tmp, + // and /root/tmp is of no use for non-root processes + unsetenv("TMPDIR"); + unsetenv("TMP"); + if (setgid(Group)) exit(errno); diff -urN cups-1.1.7.old/scheduler/server.c cups-1.1.7/scheduler/server.c --- cups-1.1.7.old/scheduler/server.c Fri May 18 16:07:38 2001 +++ cups-1.1.7/scheduler/server.c Fri May 18 16:48:45 2001 @@ -92,6 +92,11 @@ if (RunAsUser) { + // in modern systems, TMPDIR and TMP equal $HOME/tmp, + // and /root/tmp is of no use for non-root processes + unsetenv("TMPDIR"); + unsetenv("TMP"); + setgid(Group); setgroups(0, NULL); setuid(User);