Loading pxe/01-logfile.patch +12 Changes for pxe/01-logfile.patch: 12 added lines, 0 removed lines. Original line number Diff line number Diff line diff -Naur pxe-1.4.2.orig/logfile.cc pxe-1.4.2/logfile.cc --- pxe-1.4.2.orig/logfile.cc 2003-02-02 12:33:32.000000000 +0000 +++ pxe-1.4.2/logfile.cc 2006-06-30 10:07:43.000000000 +0000 @@ -57,7 +57,7 @@ LogFile::Open(const char *filename) { /* open the file */ - umask(077); + umask(022); logfile = new std::fstream(filename, std::ios::out|std::ios::app); if(logfile == NULL) { pxe/02-lockfile.patch +24 Changes for pxe/02-lockfile.patch: 24 added lines, 0 removed lines. Original line number Diff line number Diff line diff -Naur pxe-1.4.2.orig/autoconf.h.in pxe-1.4.2/autoconf.h.in --- pxe-1.4.2.orig/autoconf.h.in 2002-08-22 18:06:11.000000000 +0000 +++ pxe-1.4.2/autoconf.h.in 2006-07-22 19:50:33.000000000 +0000 @@ -61,7 +61,7 @@ /* should not need to change from here onwards */ /* the lock file */ -#define LOCKFILE "/tmp/pxe.pid" +#define LOCKFILE "/var/run/pxe/pxe.pid" #define DEF_MULTI_BOOT 0xe0000102 #define DEF_ADDR "0.0.0.0" diff -Naur pxe-1.4.2.orig/pxe.cc pxe-1.4.2/pxe.cc --- pxe-1.4.2.orig/pxe.cc 2003-02-02 12:39:26.000000000 +0000 +++ pxe-1.4.2/pxe.cc 2006-07-22 19:50:33.000000000 +0000 @@ -312,7 +312,7 @@ umask(0); // write out the pid - sprintf(pidnum, "%ld", (long)getpid()); + sprintf(pidnum, "%ld\n", (long)getpid()); if(write(chk, pidnum, strlen(pidnum)) != (ssize_t)strlen(pidnum)) { std::cerr << "Unable to write lockfile\n"; pxe/03-pidfile.patch +51 Changes for pxe/03-pidfile.patch: 51 added lines, 0 removed lines. Original line number Diff line number Diff line diff -Naur pxe-1.4.2.BAR/pxe.cc pxe-1.4.2.FOO/pxe.cc --- pxe-1.4.2.BAR/pxe.cc 2006-08-15 10:12:25.000000000 +0000 +++ pxe-1.4.2.FOO/pxe.cc 2006-08-15 10:10:51.000000000 +0000 @@ -214,7 +214,7 @@ ******************************************************************************/ int main(int argc, char **argv) { - int chk; + int chk,log; char pidnum[8]; int _debug, c, errflg; const char *configfile=PXECONFIGFILE; @@ -258,6 +258,13 @@ debug.close(); } + // check to see if the daemon is already running + chk = open(LOCKFILE, O_WRONLY|O_CREAT|O_EXCL, 0666); + if(-1 == chk) + { + std::cerr << "PXE daemon already running\n"; + return(-1); + } // set the UID/GID to a low user #ifndef NO_SUID @@ -269,6 +276,9 @@ << ", continuing with user id " << getuid() << "\n"; else { + if(log=open(PXELOGFILE, O_CREAT, 0666)) close(log); + if(chown(PXELOGFILE,pw->pw_uid,pw->pw_gid)<0) + std::cout << "Unable to acquire logfile " << PXELOGFILE << "\n"; if((-1 == setgid(pw->pw_gid)) || (-1 == setegid(pw->pw_gid))) std::cout << "Unable to change group id, continuing with group id " << getgid() << "\n"; @@ -278,14 +288,6 @@ } #endif - // check to see if the daemon is already running - chk = open(LOCKFILE, O_WRONLY|O_CREAT|O_EXCL, 0644); - if(-1 == chk) - { - std::cerr << "PXE daemon already running\n"; - return(-1); - } - // if not in debug mode, fork and go if (0 == _debug) { signal(SIGCHLD, SIG_IGN); pxe/04-gcc4.patch +19 Changes for pxe/04-gcc4.patch: 19 added lines, 0 removed lines. Original line number Diff line number Diff line diff -Naur pxe-1.4.2.orig/pxe.cc pxe-1.4.2/pxe.cc --- pxe-1.4.2.orig/pxe.cc 2006-08-15 10:49:17.000000000 +0000 +++ pxe-1.4.2/pxe.cc 2006-08-15 10:48:33.000000000 +0000 @@ -263,7 +263,7 @@ if(-1 == chk) { std::cerr << "PXE daemon already running\n"; - return(-1); + exit(-1); } // set the UID/GID to a low user @@ -333,5 +333,5 @@ StartPxeService(configfile); } - return(0); + exit(0); } pxe/Makefile.patch→pxe/05-makefile.patch +2 −2 Changes for pxe/05-makefile.patch: 2 added lines, 2 removed lines. Original line number Diff line number Diff line --- Makefile 2011-01-17 20:44:18.000000000 +0100 +++ Makefile 2011-01-17 20:48:45.000000000 +0100 --- a/Makefile 2011-01-17 20:44:18.000000000 +0100 +++ b/Makefile 2011-01-17 20:48:45.000000000 +0100 @@ -3,7 +3,11 @@ LDFLAGS = -Wl,--hash-style=gnu -Wl,--as-needed -lresolv -lnsl Loading Loading
pxe/01-logfile.patch +12 Changes for pxe/01-logfile.patch: 12 added lines, 0 removed lines. Original line number Diff line number Diff line diff -Naur pxe-1.4.2.orig/logfile.cc pxe-1.4.2/logfile.cc --- pxe-1.4.2.orig/logfile.cc 2003-02-02 12:33:32.000000000 +0000 +++ pxe-1.4.2/logfile.cc 2006-06-30 10:07:43.000000000 +0000 @@ -57,7 +57,7 @@ LogFile::Open(const char *filename) { /* open the file */ - umask(077); + umask(022); logfile = new std::fstream(filename, std::ios::out|std::ios::app); if(logfile == NULL) {
pxe/02-lockfile.patch +24 Changes for pxe/02-lockfile.patch: 24 added lines, 0 removed lines. Original line number Diff line number Diff line diff -Naur pxe-1.4.2.orig/autoconf.h.in pxe-1.4.2/autoconf.h.in --- pxe-1.4.2.orig/autoconf.h.in 2002-08-22 18:06:11.000000000 +0000 +++ pxe-1.4.2/autoconf.h.in 2006-07-22 19:50:33.000000000 +0000 @@ -61,7 +61,7 @@ /* should not need to change from here onwards */ /* the lock file */ -#define LOCKFILE "/tmp/pxe.pid" +#define LOCKFILE "/var/run/pxe/pxe.pid" #define DEF_MULTI_BOOT 0xe0000102 #define DEF_ADDR "0.0.0.0" diff -Naur pxe-1.4.2.orig/pxe.cc pxe-1.4.2/pxe.cc --- pxe-1.4.2.orig/pxe.cc 2003-02-02 12:39:26.000000000 +0000 +++ pxe-1.4.2/pxe.cc 2006-07-22 19:50:33.000000000 +0000 @@ -312,7 +312,7 @@ umask(0); // write out the pid - sprintf(pidnum, "%ld", (long)getpid()); + sprintf(pidnum, "%ld\n", (long)getpid()); if(write(chk, pidnum, strlen(pidnum)) != (ssize_t)strlen(pidnum)) { std::cerr << "Unable to write lockfile\n";
pxe/03-pidfile.patch +51 Changes for pxe/03-pidfile.patch: 51 added lines, 0 removed lines. Original line number Diff line number Diff line diff -Naur pxe-1.4.2.BAR/pxe.cc pxe-1.4.2.FOO/pxe.cc --- pxe-1.4.2.BAR/pxe.cc 2006-08-15 10:12:25.000000000 +0000 +++ pxe-1.4.2.FOO/pxe.cc 2006-08-15 10:10:51.000000000 +0000 @@ -214,7 +214,7 @@ ******************************************************************************/ int main(int argc, char **argv) { - int chk; + int chk,log; char pidnum[8]; int _debug, c, errflg; const char *configfile=PXECONFIGFILE; @@ -258,6 +258,13 @@ debug.close(); } + // check to see if the daemon is already running + chk = open(LOCKFILE, O_WRONLY|O_CREAT|O_EXCL, 0666); + if(-1 == chk) + { + std::cerr << "PXE daemon already running\n"; + return(-1); + } // set the UID/GID to a low user #ifndef NO_SUID @@ -269,6 +276,9 @@ << ", continuing with user id " << getuid() << "\n"; else { + if(log=open(PXELOGFILE, O_CREAT, 0666)) close(log); + if(chown(PXELOGFILE,pw->pw_uid,pw->pw_gid)<0) + std::cout << "Unable to acquire logfile " << PXELOGFILE << "\n"; if((-1 == setgid(pw->pw_gid)) || (-1 == setegid(pw->pw_gid))) std::cout << "Unable to change group id, continuing with group id " << getgid() << "\n"; @@ -278,14 +288,6 @@ } #endif - // check to see if the daemon is already running - chk = open(LOCKFILE, O_WRONLY|O_CREAT|O_EXCL, 0644); - if(-1 == chk) - { - std::cerr << "PXE daemon already running\n"; - return(-1); - } - // if not in debug mode, fork and go if (0 == _debug) { signal(SIGCHLD, SIG_IGN);
pxe/04-gcc4.patch +19 Changes for pxe/04-gcc4.patch: 19 added lines, 0 removed lines. Original line number Diff line number Diff line diff -Naur pxe-1.4.2.orig/pxe.cc pxe-1.4.2/pxe.cc --- pxe-1.4.2.orig/pxe.cc 2006-08-15 10:49:17.000000000 +0000 +++ pxe-1.4.2/pxe.cc 2006-08-15 10:48:33.000000000 +0000 @@ -263,7 +263,7 @@ if(-1 == chk) { std::cerr << "PXE daemon already running\n"; - return(-1); + exit(-1); } // set the UID/GID to a low user @@ -333,5 +333,5 @@ StartPxeService(configfile); } - return(0); + exit(0); }
pxe/Makefile.patch→pxe/05-makefile.patch +2 −2 Changes for pxe/05-makefile.patch: 2 added lines, 2 removed lines. Original line number Diff line number Diff line --- Makefile 2011-01-17 20:44:18.000000000 +0100 +++ Makefile 2011-01-17 20:48:45.000000000 +0100 --- a/Makefile 2011-01-17 20:44:18.000000000 +0100 +++ b/Makefile 2011-01-17 20:48:45.000000000 +0100 @@ -3,7 +3,11 @@ LDFLAGS = -Wl,--hash-style=gnu -Wl,--as-needed -lresolv -lnsl Loading