2 ** Copyright 1998 - 2004 Double Precision, Inc. See COPYING for
3 ** distribution information.
7 #include "courierauthstaticlist.h"
8 #include "courierauthsasl.h"
9 #include "courierauthdebug.h"
19 /* libtool bork-age */
24 fprintf(stderr
, "Usage: authtest [-s service] userid [ password [ newpassword ] ]\n");
28 static int callback_pre(struct authinfo
*a
, void *dummy
)
30 #define PTR(x) ((x) ? (x):"(none)")
32 printf("Authentication succeeded.\n\n");
33 printf(" Authenticated: %s ", PTR(a
->address
));
35 printf(" (system username: %s)\n", a
->sysusername
);
36 else if (a
->sysuserid
)
37 printf(" (uid %lu, gid %lu)\n", (unsigned long)*a
->sysuserid
,
38 (unsigned long)a
->sysgroupid
);
39 else printf(" (*** UID/GID initialization error***)\n");
41 printf(" Home Directory: %s\n", PTR(a
->homedir
));
42 printf(" Maildir: %s\n", PTR(a
->maildir
));
43 printf(" Quota: %s\n", PTR(a
->quota
));
44 printf("Encrypted Password: %s\n", PTR(a
->passwd
));
45 printf("Cleartext Password: %s\n", PTR(a
->clearpasswd
));
46 printf(" Options: %s\n", PTR(a
->options
));
52 int main(int argc
, char **argv
)
55 const char *service
="login";
57 for (argn
=1; argn
<argc
; argn
++)
61 if (argv
[argn
][0] != '-') break;
62 if (argv
[argn
][1] == 0)
70 switch (argv
[argn
][1]) {
72 if (!*argp
&& argn
+1 < argc
)
83 courier_authdebug_login_level
= 2;
87 if (auth_passwd(service
, argv
[argn
],
91 perror("Authentication FAILED");
96 fprintf(stderr
, "Password change succeeded.\n");
100 if (argc
- argn
>= 2)
102 if (auth_login(service
, argv
[argn
],
107 perror("Authentication FAILED");
111 else if (argc
- argn
>= 1)
113 if (auth_getuserinfo(service
, argv
[argn
],
117 perror("Authentication FAILED");