summaryrefslogtreecommitdiff
path: root/sys/src/cmd/unix/drawterm/libauth/auth_getuserpasswd.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2013-11-23 01:05:33 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2013-11-23 01:05:33 +0100
commit2f9ae0f8ac8610e13ced184847b57b87fe5db580 (patch)
treef9ad2223d518585a2cfe9ea1c73e1e37d07bf637 /sys/src/cmd/unix/drawterm/libauth/auth_getuserpasswd.c
parentea5797c0731203c09ec5fb7172e77eab2750f1a9 (diff)
removing (outdated) drawterm
drawterm is much better maintained by russ cox, so removing this outdated copy. for a more recent version, go to: http://swtch.com/drawterm/
Diffstat (limited to 'sys/src/cmd/unix/drawterm/libauth/auth_getuserpasswd.c')
-rw-r--r--sys/src/cmd/unix/drawterm/libauth/auth_getuserpasswd.c75
1 files changed, 0 insertions, 75 deletions
diff --git a/sys/src/cmd/unix/drawterm/libauth/auth_getuserpasswd.c b/sys/src/cmd/unix/drawterm/libauth/auth_getuserpasswd.c
deleted file mode 100644
index 186488f52..000000000
--- a/sys/src/cmd/unix/drawterm/libauth/auth_getuserpasswd.c
+++ /dev/null
@@ -1,75 +0,0 @@
-#include <u.h>
-#include <libc.h>
-#include <auth.h>
-#include "authlocal.h"
-
-enum {
- ARgiveup = 100,
-};
-
-static int
-dorpc(AuthRpc *rpc, char *verb, char *val, int len, AuthGetkey *getkey)
-{
- int ret;
-
- for(;;){
- if((ret = auth_rpc(rpc, verb, val, len)) != ARneedkey && ret != ARbadkey)
- return ret;
- if(getkey == 0)
- return ARgiveup; /* don't know how */
- if((*getkey)(rpc->arg) < 0)
- return ARgiveup; /* user punted */
- }
-}
-
-UserPasswd*
-auth_getuserpasswd(AuthGetkey *getkey, char *fmt, ...)
-{
- AuthRpc *rpc;
- char *f[3], *p, *params;
- int fd;
- va_list arg;
- UserPasswd *up;
-
- up = nil;
- rpc = nil;
- params = nil;
-
- fd = open("/mnt/factotum/rpc", ORDWR);
- if(fd < 0)
- goto out;
- rpc = auth_allocrpc(fd);
- if(rpc == nil)
- goto out;
- quotefmtinstall(); /* just in case */
- va_start(arg, fmt);
- params = vsmprint(fmt, arg);
- va_end(arg);
- if(params == nil)
- goto out;
-
- if(dorpc(rpc, "start", params, strlen(params), getkey) != ARok
- || dorpc(rpc, "read", nil, 0, getkey) != ARok)
- goto out;
-
- rpc->arg[rpc->narg] = '\0';
- if(tokenize(rpc->arg, f, 2) != 2){
- werrstr("bad answer from factotum");
- goto out;
- }
- up = malloc(sizeof(*up)+rpc->narg+1);
- if(up == nil)
- goto out;
- p = (char*)&up[1];
- strcpy(p, f[0]);
- up->user = p;
- p += strlen(p)+1;
- strcpy(p, f[1]);
- up->passwd = p;
-
-out:
- free(params);
- auth_freerpc(rpc);
- close(fd);
- return up;
-}