* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define RCSID "$Id: main.c,v 1.86 1999/09/11 12:08:57 paulus Exp $"
+#define RCSID "$Id: main.c,v 1.87 1999/11/15 03:55:37 paulus Exp $"
#include <stdio.h>
#include <ctype.h>
}
hostname[MAXNAMELEN-1] = 0;
+ /* make sure we don't create world or group writable files. */
+ umask(umask(0777) | 022);
+
uid = getuid();
privileged = uid == 0;
slprintf(numbuf, sizeof(numbuf), "%d", uid);
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define RCSID "$Id: options.c,v 1.67 1999/11/15 01:51:52 paulus Exp $"
+#define RCSID "$Id: options.c,v 1.68 1999/11/15 03:55:37 paulus Exp $"
#include <ctype.h>
#include <stdio.h>
if (!privileged_option)
seteuid(getuid());
- fd = open(*argv, O_WRONLY | O_APPEND);
+ fd = open(*argv, O_WRONLY | O_APPEND | O_CREAT | O_EXCL, 0644);
+ if (fd < 0 && errno == EEXIST)
+ fd = open(*argv, O_WRONLY | O_APPEND);
err = errno;
if (!privileged_option)
seteuid(0);