xref: /plan9/sys/src/libauth/amount.c (revision 9a747e4fd48b9f4522c70c07e8f882a15030f964)
1 #include <u.h>
2 #include <libc.h>
3 #include <auth.h>
4 #include "authlocal.h"
5 
6 int
amount(int fd,char * mntpt,int flags,char * aname)7 amount(int fd, char *mntpt, int flags, char *aname)
8 {
9 	int rv, afd;
10 	AuthInfo *ai;
11 
12 	afd = fauth(fd, aname);
13 	if(afd >= 0){
14 		ai = auth_proxy(afd, amount_getkey, "proto=p9any role=client");
15 		if(ai != nil)
16 			auth_freeAI(ai);
17 	}
18 	rv = mount(fd, afd, mntpt, flags, aname);
19 	if(afd >= 0)
20 		close(afd);
21 	return rv;
22 }
23