2 ** Copyright 1998 - 2004 Double Precision, Inc. See COPYING for
3 ** distribution information.
7 #include "authstaticlist.h"
8 #include "courierauthsasl.h"
9 #include "courierauthdebug.h"
19 /* libtool bork-age */
21 static const char authtest_rcsid
[]="$Id: authtest.c,v 1.13 2004/11/17 01:16:00 mrsam Exp $";
25 fprintf(stderr
, "Usage: authtest [-s service] userid [ password [ newpassword ] ]\n");
29 static int callback_pre(struct authinfo
*a
, void *dummy
)
31 #define PTR(x) ((x) ? (x):"(none)")
33 printf("Authentication succeeded.\n\n");
34 printf(" Authenticated: %s ", PTR(a
->address
));
36 printf(" (system username: %s)\n", a
->sysusername
);
37 else if (a
->sysuserid
)
38 printf(" (uid %lu, gid %lu)\n", (unsigned long)*a
->sysuserid
,
39 (unsigned long)a
->sysgroupid
);
40 else printf(" (*** UID/GID initialization error***)\n");
42 printf(" Home Directory: %s\n", PTR(a
->homedir
));
43 printf(" Maildir: %s\n", PTR(a
->maildir
));
44 printf(" Quota: %s\n", PTR(a
->quota
));
45 printf("Encrypted Password: %s\n", PTR(a
->passwd
));
46 printf("Cleartext Password: %s\n", PTR(a
->clearpasswd
));
47 printf(" Options: %s\n", PTR(a
->options
));
53 int main(int argc
, char **argv
)
56 const char *service
="login";
58 for (argn
=1; argn
<argc
; argn
++)
62 if (argv
[argn
][0] != '-') break;
63 if (argv
[argn
][1] == 0)
71 switch (argv
[argn
][1]) {
73 if (!*argp
&& argn
+1 < argc
)
84 courier_authdebug_login_level
= 2;
88 if (auth_passwd(service
, argv
[argn
],
92 perror("Authentication FAILED");
97 fprintf(stderr
, "Password change succeeded.\n");
101 if (argc
- argn
>= 2)
103 if (auth_login(service
, argv
[argn
],
108 perror("Authentication FAILED");
112 else if (argc
- argn
>= 1)
114 if (auth_getuserinfo(service
, argv
[argn
],
118 perror("Authentication FAILED");