open master.passwd before doing pw_copy
authorprovos <provos@openbsd.org>
Tue, 18 Feb 1997 23:38:58 +0000 (23:38 +0000)
committerprovos <provos@openbsd.org>
Tue, 18 Feb 1997 23:38:58 +0000 (23:38 +0000)
libexec/rpc.yppasswdd/yppasswdd_mkpw.c

index 2c2846d..fdcb84d 100644 (file)
  */
 
 #ifndef LINT
-static char rcsid[] = "$Id: yppasswdd_mkpw.c,v 1.11 1997/02/18 22:44:49 provos Exp $";
+static char rcsid[] = "$Id: yppasswdd_mkpw.c,v 1.12 1997/02/18 23:38:58 provos Exp $";
 #endif
 
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <stdio.h>
+#include <fcntl.h>
 #include <rpc/rpc.h>
 #include <rpcsvc/yppasswd.h>
 #include <pwd.h>
@@ -117,6 +118,10 @@ make_passwd(argp)
                return (1);
        }
 
+       pfd = open(_PATH_MASTERPASSWD, O_RDONLY, 0);
+       if (pfd < 0)
+               pw_error(_PATH_MASTERPASSWD, 1, 1);
+
        pw_init();
        tfd = pw_lock(0);