SCCS-vsn: usr.sbin/pwd_mkdb/pwd_mkdb.c 8.5
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)pwd_mkdb.c 8.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)pwd_mkdb.c 8.5 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
sigaddset(&set, SIGTERM);
(void)sigprocmask(SIG_BLOCK, &set, (sigset_t *)NULL);
sigaddset(&set, SIGTERM);
(void)sigprocmask(SIG_BLOCK, &set, (sigset_t *)NULL);
+ /* We don't care what the user wants. */
+ (void)umask(0);
+
pname = *argv;
/* Open the original password file */
if (!(fp = fopen(pname, "r")))
pname = *argv;
/* Open the original password file */
if (!(fp = fopen(pname, "r")))
* chance the file already existing, since someone (stupidly) might
* still be using this for permission checking. So, open it first and
* fdopen the resulting fd. The resulting file should be readable by
* chance the file already existing, since someone (stupidly) might
* still be using this for permission checking. So, open it first and
* fdopen the resulting fd. The resulting file should be readable by
- * everyone, don't trust the user's umask.
*/
if (makeold) {
(void)snprintf(buf, sizeof(buf), "%s.orig", pname);
if ((tfd = open(buf,
O_WRONLY|O_CREAT|O_EXCL, PERM_INSECURE)) < 0)
error(buf);
*/
if (makeold) {
(void)snprintf(buf, sizeof(buf), "%s.orig", pname);
if ((tfd = open(buf,
O_WRONLY|O_CREAT|O_EXCL, PERM_INSECURE)) < 0)
error(buf);
- (void)fchmod(tfd, PERM_INSECURE);
if ((oldfp = fdopen(tfd, "w")) == NULL)
error(buf);
clean = FILE_ORIG;
if ((oldfp = fdopen(tfd, "w")) == NULL)
error(buf);
clean = FILE_ORIG;