remove gcc34
[dragonfly.git] / crypto / heimdal-0.6.3 / appl / popper / pop_user.c
1 /*
2  * Copyright (c) 1989 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  */
6
7 #include <popper.h>
8 RCSID("$Id: pop_user.c,v 1.15 1999/09/16 20:38:50 assar Exp $");
9
10 /* 
11  *  user:   Prompt for the user name at the start of a POP session
12  */
13
14 int
15 pop_user (POP *p)
16 {
17     char ss[256];
18
19     strlcpy(p->user, p->pop_parm[1], sizeof(p->user));
20
21 #ifdef OTP
22     if (otp_challenge (&p->otp_ctx, p->user, ss, sizeof(ss)) == 0) {
23         return pop_msg(p, POP_SUCCESS, "Password %s required for %s.",
24                        ss, p->user);
25     } else
26 #endif
27     if (p->auth_level != AUTH_NONE) {
28         char *s = NULL;
29 #ifdef OTP
30         s = otp_error(&p->otp_ctx);
31 #endif
32         return pop_msg(p, POP_FAILURE, "Permission denied%s%s",
33                        s ? ":" : "", s ? s : "");
34     } else
35         return pop_msg(p, POP_SUCCESS, "Password required for %s.", p->user);
36 }