1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
? Linux-PAM/modules/pam_unix/dynamic
? Linux-PAM/modules/pam_unix/unix_chkpwd
Index: Linux-PAM/modules/pam_unix/support.c
===================================================================
RCS file: /afs/sipb.mit.edu/project/debian/cvs/pam/Linux-PAM/modules/pam_unix/support.c,v
retrieving revision 1.8
diff -u -r1.8 support.c
--- Linux-PAM/modules/pam_unix/support.c 31 May 2003 23:46:17 -0000 1.8
+++ Linux-PAM/modules/pam_unix/support.c 24 Mar 2004 00:51:35 -0000
@@ -33,24 +33,25 @@
void _log_err(int err, pam_handle_t *pamh, const char *format,...)
{
- char *service = NULL;
- char logname[256];
va_list args;
+ const char tag[] = "(pam_unix) ";
+ char *mod_format;
+ int free_mod_format = 1;
- pam_get_item(pamh, PAM_SERVICE, (const void **) &service);
- if (service) {
- strncpy(logname, service, sizeof(logname));
- logname[sizeof(logname) - 1 - strlen("(pam_unix)")] = '\0';
- strncat(logname, "(pam_unix)", strlen("(pam_unix)"));
+ mod_format = malloc( 1 + sizeof(tag) + strlen(format));
+ if(mod_format == NULL) {
+ free_mod_format = 0;
+ mod_format = (char *) format;
} else {
- strncpy(logname, "pam_unix", sizeof(logname) - 1);
+ strcpy(mod_format, tag);
+ strcat( mod_format, format);
}
va_start(args, format);
- openlog(logname, LOG_CONS | LOG_PID, LOG_AUTH);
- vsyslog(err, format, args);
+ vsyslog(err | LOG_AUTH, mod_format, args);
va_end(args);
- closelog();
+
+ if (free_mod_format) free(mod_format);
}
/* this is a front-end for module-application conversations */
|