Move hcoop changes to quilt patch
[hcoop/debian/courier-authlib.git] / debian / patches / 0006-hcoop-openafs-changes.patch
1 --- a/authpam.c
2 +++ b/authpam.c
3 @@ -128,19 +128,20 @@
4 }
5 }
6
7 -#if 0
8
9 #if HAVE_PAM_SETCRED
10 + fprintf(stderr, "pam_setcred...\n");
11 if (retval == PAM_SUCCESS)
12 {
13 retval=pam_setcred(*pamh, PAM_ESTABLISH_CRED);
14 if (retval != PAM_SUCCESS)
15 {
16 - DPRINTF("pam_setcred failed, result %d", retval);
17 + fprintf(stderr, "pam_setcred failed, result %d\n", retval);
18 }
19 + fprintf(stderr, "pam_setcred done\n");
20 }
21 #endif
22 -#endif
23 +
24
25 if (retval == PAM_SUCCESS)
26 {
27 --- a/courier_auth_config.h
28 +++ b/courier_auth_config.h
29 @@ -256,7 +256,7 @@
30 #define STDC_HEADERS 1
31
32 /* Location of the userdb database */
33 -#define USERDB "/usr/local/etc/authlib/userdb"
34 +#define USERDB "/etc/courier/userdb"
35
36 /* Version number of package */
37 /* #undef VERSION */
38 --- a/preauthuserdbcommon.c
39 +++ b/preauthuserdbcommon.c
40 @@ -14,11 +14,13 @@
41 #if HAVE_UNISTD_H
42 #include <unistd.h>
43 #endif
44 +#include <sys/types.h>
45 +#include <sys/wait.h>
46
47 #include "auth.h"
48 #include "courierauthdebug.h"
49 #include "userdb/userdb.h"
50 -
51 +#include "numlib/numlib.h"
52
53 int auth_userdb_pre_common(const char *userid, const char *service,
54 int needpass,
55 @@ -105,6 +107,27 @@
56 auth.maildir=udb->udb_mailbox;
57 auth.quota=udb->udb_quota;
58
59 + /* Get tokens for AFS */
60 + {
61 + if (auth.sysuserid)
62 + {
63 + pid_t pid = fork ();
64 +
65 + if (pid == 0)
66 + {
67 + char uidstr[32] = "<null>";
68 + snprintf(uidstr, sizeof(uidstr), "%ld", (long)*auth.sysuserid);
69 +
70 + libmail_changeuidgid (*auth.sysuserid, auth.sysgroupid);
71 + execl ("/etc/courier/get-token", "get-token", uidstr, NULL);
72 + }
73 + else
74 + {
75 + waitpid (pid, NULL, 0);
76 + }
77 + }
78 + }
79 +
80 courier_authdebug_authinfo("DEBUG: authuserdb: ", &auth, 0, passwords);
81 rc= (*callback)(&auth, arg);
82 if (passwords) free(passwords);