amount.c 393 B

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