From: Ben Gras Date: Tue, 17 Jun 2014 15:51:52 +0000 (+0200) Subject: Fix passwd entries, from old format to new. X-Git-Tag: v3.3.0~189 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=fcce231cb7d40edd4f1411faf4d88748dd28a87e;p=minix.git Fix passwd entries, from old format to new. Change-Id: I78278f0cdc6b9b87bf9b3a14970a462037589d87 --- diff --git a/drivers/ramdisk/Makefile b/drivers/ramdisk/Makefile index ccbccfbd0..606b11f02 100644 --- a/drivers/ramdisk/Makefile +++ b/drivers/ramdisk/Makefile @@ -27,7 +27,7 @@ RAMDISK_DEFINES= \ PROTO= proto # Common to all architectures -ETC= system.conf master.passwd group +ETC= system.conf group EXTRA= rc PROTO_FILES= proto.common.etc proto.common.dynamic PROG_DRIVERS= @@ -97,7 +97,8 @@ PROGROOT:= ${.OBJDIR:S,/drivers/ramdisk,,} # Generate dependencies rules for config files .for etc in ${ETC} -${etc}: ${NETBSDSRCDIR}/etc/${etc} +etc/${etc}: ${NETBSDSRCDIR}/etc/${etc} + mkdir -p ${.OBJDIR}/etc ${INSTALL} $> $@ .endfor @@ -140,7 +141,7 @@ ${PROGROOT}/${srcdir}/${dir.${prog}:U${prog}}/${prog}: .endfor # prog .endfor # srcdir -realall image: proto.gen ${ETC} ${EXTRA} pwd.db spwd.db passwd group +realall image: proto.gen ${ETC:C/^/etc\//} ${EXTRA} etc/master.passwd etc/pwd.db etc/spwd.db etc/passwd etc/group ${_MKMSG_CREATE} "Generating ramdisk image" ${TOOL_MKFSMFS} image proto.gen || { rm -f image; false; } # if fsck.mfs -s image | grep -q CLEAN; \ @@ -150,17 +151,14 @@ realall image: proto.gen ${ETC} ${EXTRA} pwd.db spwd.db passwd group # rm -f image; false; \ # fi +etc/pwd.db etc/spwd.db etc/passwd: etc/master.passwd + etc/master.passwd: ${NETBSDSRCDIR}/etc/master.passwd rm -rf ${.OBJDIR}/etc/ mkdir -p ${.OBJDIR}/etc ${INSTALL} $> $@ ${TOOL_PWD_MKDB} -V 0 -p -d . etc/master.passwd -# LSC We use @F because some version of make still output a full path for @, -# even when the target is just a file name -pwd.db spwd.db passwd: etc/master.passwd - ${INSTALL} etc/${@F} ${@F} - proto.dev.mtree: @echo ". type=dir uname=root gname=operator mode=0755" \ >${.TARGET}.tmp && \ @@ -172,8 +170,8 @@ proto.dev.mtree: # We have to remove the two first entries of the generated proto file, as # well as the two last ones (closing $). # Do not forget to double $ so that make doesn't try to expand it. -proto.dev: proto.dev.mtree pwd.db spwd.db passwd group - ${TOOL_MTREE} -f ${.TARGET}.mtree -N ${.OBJDIR} -C -K device | \ +proto.dev: proto.dev.mtree etc/pwd.db etc/spwd.db etc/passwd etc/group + ${TOOL_MTREE} -f ${.TARGET}.mtree -N ${.OBJDIR}/etc -C -K device | \ ${TOOL_TOPROTO} | ${TOOL_SED} -e '1,4d' | \ ${TOOL_SED} -e '$$d' |${TOOL_SED} -e '$$d' > ${.TARGET}.tmp && \ mv ${.TARGET}.tmp ${.TARGET} diff --git a/drivers/ramdisk/proto.common.etc b/drivers/ramdisk/proto.common.etc index bd6de5250..4c3107338 100644 --- a/drivers/ramdisk/proto.common.etc +++ b/drivers/ramdisk/proto.common.etc @@ -1,12 +1,12 @@ etc d--755 0 0 mtab s--555 2 1 /proc/mounts - system.conf ---644 0 0 system.conf - passwd ---644 0 0 passwd - pwd.db ---644 0 0 pwd.db - spwd.db ---600 0 0 spwd.db - master.passwd ---600 0 0 master.passwd + system.conf ---644 0 0 etc/system.conf + passwd ---644 0 0 etc/passwd + pwd.db ---644 0 0 etc/pwd.db + spwd.db ---600 0 0 etc/spwd.db + master.passwd ---600 0 0 etc/master.passwd rc ---755 0 0 rc #if defined(__i386__) - rs.single ---755 0 0 rs.single + rs.single ---755 0 0 etc/rs.single #endif $ diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.c b/usr.sbin/pwd_mkdb/pwd_mkdb.c index 25d89be82..f7785ae85 100644 --- a/usr.sbin/pwd_mkdb/pwd_mkdb.c +++ b/usr.sbin/pwd_mkdb/pwd_mkdb.c @@ -439,15 +439,9 @@ main(int argc, char *argv[]) * Create original format password file entry. */ if (makeold) { -#if defined(__minix) - (void)fprintf(oldfp, "%s:##%s:%d:%d:%s:%s:%s\n", - pwd.pw_name, pwd.pw_name, pwd.pw_uid, pwd.pw_gid, - pwd.pw_gecos, pwd.pw_dir, pwd.pw_shell); -#else (void)fprintf(oldfp, "%s:*:%d:%d:%s:%s:%s\n", pwd.pw_name, pwd.pw_uid, pwd.pw_gid, pwd.pw_gecos, pwd.pw_dir, pwd.pw_shell); -#endif /* defined(__minix) */ if (ferror(oldfp)) wr_error(oldpwdfile); }