clean better
[heimdal.git] / appl / popper / pop_user.c
blob56d07842a5f17836c2b9452b70e0b035eedca3b2
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 */
7 #include <popper.h>
8 RCSID("$Id$");
11 * user: Prompt for the user name at the start of a POP session
14 int
15 pop_user (POP *p)
17 strlcpy(p->user, p->pop_parm[1], sizeof(p->user));
19 if (p->auth_level == AUTH_OTP) {
20 #ifdef OTP
21 char ss[256], *s;
23 if(otp_challenge (&p->otp_ctx, p->user, ss, sizeof(ss)) == 0)
24 return pop_msg(p, POP_SUCCESS, "Password %s required for %s.",
25 ss, p->user);
26 s = otp_error(&p->otp_ctx);
27 return pop_msg(p, POP_FAILURE, "Permission denied%s%s",
28 s ? ":" : "", s ? s : "");
29 #endif
31 if (p->auth_level == AUTH_SASL) {
32 return pop_msg(p, POP_FAILURE, "Permission denied");
34 return pop_msg(p, POP_SUCCESS, "Password required for %s.", p->user);