summaryrefslogtreecommitdiff
path: root/sys/src/cmd/auth/userpasswd.c
diff options
context:
space:
mode:
authorTaru Karttunen <taruti@taruti.net>2011-03-30 15:46:40 +0300
committerTaru Karttunen <taruti@taruti.net>2011-03-30 15:46:40 +0300
commite5888a1ffdae813d7575f5fb02275c6bb07e5199 (patch)
treed8d51eac403f07814b9e936eed0c9a79195e2450 /sys/src/cmd/auth/userpasswd.c
Import sources from 2011-03-30 iso image
Diffstat (limited to 'sys/src/cmd/auth/userpasswd.c')
-rwxr-xr-xsys/src/cmd/auth/userpasswd.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/sys/src/cmd/auth/userpasswd.c b/sys/src/cmd/auth/userpasswd.c
new file mode 100755
index 000000000..ec9741132
--- /dev/null
+++ b/sys/src/cmd/auth/userpasswd.c
@@ -0,0 +1,34 @@
+#include <u.h>
+#include <libc.h>
+#include <auth.h>
+
+void
+usage(void)
+{
+ fprint(2, "usage: auth/userpasswd fmt\n");
+ exits("usage");
+}
+
+void
+main(int argc, char **argv)
+{
+ UserPasswd *up;
+
+ ARGBEGIN{
+ default:
+ usage();
+ }ARGEND
+
+ if(argc != 1)
+ usage();
+
+ up = auth_getuserpasswd(auth_getkey, "proto=pass %s", argv[0]);
+ if(up == nil) /* bug in factotum, fixed but need to reboot servers -rsc, 2/10/2002 */
+ up = auth_getuserpasswd(nil, "proto=pass %s", argv[0]);
+ if(up == nil)
+ sysfatal("getuserpasswd: %r");
+
+ quotefmtinstall();
+ print("%s\n%s\n", up->user, up->passwd);
+ exits(0);
+}