Debian Codegraph @

debian/patches/debian.patch

raw
1 --- libpam-chroot-0.9.orig/Makefile
2 +++ libpam-chroot-0.9/Makefile
3 @@ -3,17 +3,22 @@
4 CC=gcc
5 CFLAGS=-fPIC -O2 -Wall -Werror -pedantic
6 CPPFLAGS=-I.
7 -LDFLAGS=-x --shared -lpam
8 +LDFLAGS=-shared
9 +DESTDIR=/
10 +LIBDIR=$(DESTDIR)/lib/security
11 +INSTALL?=install
12
13 OUT=pam_chroot.so
14 +CONF=chroot.conf
15
16 all: $(OUT)
17
18 %.so: %.o
19 - ld $(LDFLAGS) -o $@ $<
20 + $(CC) $(LDFLAGS) -o $@ $< -lpam
21
22 clean:
23 rm -f *.o $(OUT)
24
25 install:
26 - install -s -o0 -g0 -m755 $(OUT) /lib/security
27 + $(INSTALL) -s -o0 -g0 -m755 $(OUT) $(LIBDIR)
28 + install -m640 $(CONF) $(DESTDIR)/etc/security
29 --- libpam-chroot-0.9.orig/TROUBLESHOOTING
30 +++ libpam-chroot-0.9/TROUBLESHOOTING
31 @@ -6,7 +6,7 @@ also want to check the pam-list archives
32 Note that all of the following assumes that you have put pam_chroot into
33 debug mode (add the "debug" option to the pam_chroot line in the
34 appropriate /etc/pam.d file) and that syslogd is configured to put
35 -auth.debug messages in some known location (/var/log/messages,
36 +auth.notice and auth.debug messages in some known location (/var/log/messages,
37 /var/adm/messages, /var/adm/syslog/syslog.log, etc.)
38
39 Under normal operation, pam_chroot will output something similar to the
40 @@ -42,8 +42,8 @@ SOLUTION: This usually indicates that th
41 appropriate /etc/pam.d file, or it might be that PAM is not being used
42 at all. (For example, you might have set 'UsePAM no' in your
43 /etc/ssh/sshd_config.) It might also be that syslogd is not running or
44 - is not configured to report auth.debug messages in the file that you're
45 - looking for them in.
46 + is not configured to report auth.notice and auth.debug messages in the
47 + file that you're looking for them in.
48 There are a multitude of reasons that PAM might not be being used, and
49 they're usually application configuration issues, rather than issues with
50 PAM itself.
51 --- libpam-chroot-0.9.orig/chroot.conf
52 +++ libpam-chroot-0.9/chroot.conf
53 @@ -1,6 +1,13 @@
54 # /etc/security/chroot.conf
55 -# format:
56 +# This file determines where will pam_chroot restrict the
57 +# users for applications that use this module.
58 +# Users not listed in this configuration file will not
59 +# be chrooted.
60 +# The format of this configuration file is:
61 +#
62 # username chroot_dir
63 +#
64 +# For example:
65 #foo /home/foo
66
67 # Or, if you've specified use_regex,
68 --- libpam-chroot-0.9.orig/pam_chroot.c
69 +++ libpam-chroot-0.9/pam_chroot.c
70 @@ -68,14 +68,14 @@ static void _pam_log(int err, const char
71 /* initialize opts to a standard known state */
72 int _pam_opts_init(struct _pam_opts* opts) {
73 if(NULL == opts) {
74 - _pam_log(LOG_ERR, "%s: NULL opts pointer", __FUNCTION__);
75 + _pam_log(LOG_ERR, "%s: NULL opts pointer", __extension__ __FUNCTION__);
76 return _PAM_CHROOT_INTERNALERR;
77 }
78
79 opts->flags = _PAM_OPTS_NOOPTS;
80 opts->chroot_dir = NULL;
81
82 - opts->conf = x_strdup(CONFIG);
83 + opts->conf = strdup(CONFIG);
84 if(NULL == opts->conf) {
85 _pam_log(LOG_ERR, "strdup: %s", strerror(errno));
86 return _PAM_CHROOT_SYSERR;
87 @@ -91,7 +91,7 @@ int _pam_opts_config(struct _pam_opts* o
88 int i;
89
90 if(NULL == opts) {
91 - _pam_log(LOG_ERR, "%s: NULL opts pointer", __FUNCTION__);
92 + _pam_log(LOG_ERR, "%s: NULL opts pointer", __extension__ __FUNCTION__);
93 return _PAM_CHROOT_INTERNALERR;
94 }
95
96 @@ -133,7 +133,7 @@ int _pam_opts_config(struct _pam_opts* o
97 } else if(!strncmp(argv[i], "onerr=", 6)) {
98 if(!strcmp(argv[i] + 6, "succeed")) {
99 opts->flags = opts->flags & (~_PAM_OPTS_NOTFOUNDFAILS);
100 - } else if(!strcmp(argv[i] + 9, "fail")) {
101 + } else if(!strcmp(argv[i] + 6, "fail")) {
102 opts->flags = opts->flags | _PAM_OPTS_NOTFOUNDFAILS;
103 } else {
104 _pam_log(LOG_ERR, "bad config option: \"%s\"", argv[i]);
105 @@ -146,7 +146,7 @@ int _pam_opts_config(struct _pam_opts* o
106 _pam_log(LOG_ERR,
107 "bad config option: \"%s\": chroot dir already set", argv[i]);
108 } else {
109 - opts->chroot_dir = x_strdup(argv[i] + 11);
110 + opts->chroot_dir = strdup(argv[i] + 11);
111 if(NULL == opts->chroot_dir) {
112 _pam_log(LOG_ERR, "strdup: %s", strerror(errno));
113 }
114 @@ -162,7 +162,7 @@ int _pam_opts_config(struct _pam_opts* o
115 /* free the allocated memory of a struct _pam_opts */
116 int _pam_opts_free(struct _pam_opts* opts) {
117 if(NULL == opts) {
118 - _pam_log(LOG_ERR, "%s: NULL opts pointer", __FUNCTION__);
119 + _pam_log(LOG_ERR, "%s: NULL opts pointer", __extension__ __FUNCTION__);
120 }
121 _pam_drop(opts->chroot_dir);
122 _pam_drop(opts->conf);
123 @@ -187,7 +187,7 @@ int _pam_getugroups(const char *user, gi
124 char **uptr;
125
126 if(NULL == user || NULL == ngrps) { return -1; }
127 - if(0 > *ngrps || 0 > gid) { return -1; }
128 + if(0 > *ngrps) { return -1; }
129
130 if(gcount < *ngrps) {
131 if(NULL != grps) { grps[gcount] = gid; }
132 @@ -261,19 +261,19 @@ char** _pam_get_groups(const char* user,
133 gids = (gid_t*) malloc(ngroups*sizeof(gid_t));
134 if(NULL == gids) {
135 _pam_log(LOG_ERR, "%s: %s: malloc: %s",
136 - opts->module, __FUNCTION__, strerror(errno));
137 + opts->module, __extension__ __FUNCTION__, strerror(errno));
138 return NULL;
139 }
140 ret = _PAM_GETUGROUPS(pwd->pw_name, pwd->pw_gid, gids, &ngroups);
141 if(-1 == ret) {
142 _pam_log(LOG_WARNING,
143 "%s: %s: _PAM_GETUGROUPS found more gids on second run",
144 - opts->module, __FUNCTION__);
145 + opts->module, __extension__ __FUNCTION__);
146 }
147 if(0 >= ngroups) {
148 _pam_log(LOG_ERR,
149 "%s: %s: _PAM_GETUGROUPS returned no groups for user \"%s\"",
150 - opts->module, __FUNCTION__, user);
151 + opts->module, __extension__ __FUNCTION__, user);
152 _pam_drop(gids);
153 return NULL;
154 }
155 @@ -282,7 +282,7 @@ char** _pam_get_groups(const char* user,
156 groups = (char**)malloc((ngroups+1)*sizeof(char*));
157 if(NULL == groups) {
158 _pam_log(LOG_ERR, "%s: %s: malloc: %s",
159 - opts->module, __FUNCTION__, strerror(errno));
160 + opts->module, __extension__ __FUNCTION__, strerror(errno));
161 _pam_drop(gids);
162 return NULL;
163 }
164 @@ -291,9 +291,9 @@ char** _pam_get_groups(const char* user,
165 if(NULL == grp) {
166 _pam_log(LOG_DEBUG, "%s: no grnam for gid %d", opts->module, gids[i]);
167 snprintf(scratch, SCRATCH, "%d", gids[i]);
168 - groups[i] = x_strdup(scratch);
169 + groups[i] = strdup(scratch);
170 } else {
171 - groups[i] = x_strdup(grp->gr_name);
172 + groups[i] = strdup(grp->gr_name);
173 }
174 }
175 groups[i] = NULL;
176 @@ -322,7 +322,7 @@ int _pam_check_path_perms(char *path, st
177 char save;
178 struct stat st;
179
180 - path = x_strdup(path);
181 + path = strdup(path);
182 if(NULL == path) {
183 _pam_log(LOG_ERR, "strdup: %s", strerror(errno));
184 return -1;
185 @@ -382,7 +382,7 @@ char* _pam_expand_chroot_dir(const char*
186 return NULL;
187 }
188
189 - exp = x_strdup(path);
190 + exp = strdup(path);
191 if(NULL == exp) {
192 _pam_log(LOG_ERR, "%s: strdup: %s", opts->module, strerror(errno));
193 return NULL;
194 @@ -533,7 +533,7 @@ int _pam_get_chrootdir(const char* user,
195 char *errbuf = malloc(len);
196 if(NULL == errbuf) {
197 _pam_log(LOG_ERR, "%s: %s: malloc: %s",
198 - opts->module, __FUNCTION__, strerror(errno));
199 + opts->module, __extension__ __FUNCTION__, strerror(errno));
200 if(opts->flags & _PAM_OPTS_USE_GROUPS) {
201 _pam_free_groups(group_list);
202 }
203 @@ -639,10 +639,8 @@ int _pam_get_chrootdir(const char* user,
204 * then pass it to this function */
205 int _pam_do_chroot(pam_handle_t *pamh, struct _pam_opts *opts) {
206 int err,debug;
207 - char *name;
208 char const *user;
209
210 - name = NULL;
211 debug = opts->flags & _PAM_OPTS_DEBUG;
212
213 err = pam_get_user(pamh, &user, NULL);
214 @@ -872,7 +870,7 @@ PAM_EXTERN int pam_sm_open_session(pam_h
215 break;
216
217 default:
218 - if(opts.flags * _PAM_OPTS_DEBUG) {
219 + if(opts.flags & _PAM_OPTS_DEBUG) {
220 _pam_log(LOG_NOTICE, "%s: returning failure", opts.module);
221 }
222 err = PAM_SESSION_ERR;