patches/xscreensaver-14-pam_audit.diff
author rohinis
Tue, 29 Nov 2011 17:32:55 +0000
branchs11express-2010-11
changeset 22234 c23e64da3e06
parent 21473 8a5e3434934f
permissions -rw-r--r--
2011-11-29 Rohini S <[email protected]> * patches/Python26-22-audio.diff: Fixes CVE-2010-1634 * specs/SUNWPython26.spec: Fixes CR 7085446
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
     1
/*
21473
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
     2
 * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
     3
 *
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
     4
 * Permission is hereby granted, free of charge, to any person obtaining a
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
     5
 * copy of this software and associated documentation files (the "Software"),
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
     6
 * to deal in the Software without restriction, including without limitation
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
     7
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
     8
 * and/or sell copies of the Software, and to permit persons to whom the
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
     9
 * Software is furnished to do so, subject to the following conditions:
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    10
 *
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    11
 * The above copyright notice and this permission notice (including the next
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    12
 * paragraph) shall be included in all copies or substantial portions of the
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    13
 * Software.
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    14
 *
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    15
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    16
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    17
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    18
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    19
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    20
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    21
 * DEALINGS IN THE SOFTWARE.
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    22
 */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    23
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    24
Fixes for bugs:
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    25
5015296, P1, gnome/screensaver - xscreensaver doesn't audit
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    26
6417168, P3, gnome/screensaver - xscreensaver loops while trying to unlock a session for a user whose password was expired
21473
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
    27
7008058, P3, screensaver continues to accept old password for existing sessions after password changed
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
    28
---
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
    29
 driver/Makefile.in  |    6 +-
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
    30
 driver/passwd-pam.c |  177 ++++++++++++++++++++++++++++++++++++++++++++++++---
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
    31
 driver/passwd.c     |    4 +
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
    32
 3 files changed, 174 insertions(+), 13 deletions(-)
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    33
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    34
diff --git xscreensaver-5.11/driver/Makefile.in xscreensaver-5.11/driver/Makefile.in
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    35
--- xscreensaver-5.11/driver/Makefile.in
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    36
+++ xscreensaver-5.11/driver/Makefile.in
21473
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
    37
@@ -109,8 +109,8 @@ TRUSTED_LIBS	= -lglib-2.0 -lsecdb
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
    38
 TRUSTED_SRCS	= trusted-utils.c
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
    39
 TRUSTED_OBJS	= trusted-utils.o
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
    40
 
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
    41
-PWENT_SRCS	= passwd-pwent.c
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
    42
-PWENT_OBJS	= passwd-pwent.o
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
    43
+PWENT_SRCS	= # passwd-pwent.c - Not used in Solaris builds
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
    44
+PWENT_OBJS	= # passwd-pwent.o - Not used in Solaris builds
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
    45
 
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
    46
 KERBEROS_SRCS	= passwd-kerberos.c
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
    47
 KERBEROS_OBJS	= passwd-kerberos.o
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    48
@@ -217,7 +217,7 @@ PDF2JPEG_LIBS	= -framework Cocoa
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    49
 SAVER_LIBS	= $(LIBS) $(X_LIBS) $(XMU_LIBS) @SAVER_LIBS@ \
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    50
 		  $(XDPMS_LIBS) $(XINERAMA_LIBS) $(GL_LIBS) $(X_PRE_LIBS) \
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    51
 		  -lXt -lX11 -lXext -lXi $(X_EXTRA_LIBS) \
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    52
-		  $(PASSWD_LIBS)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    53
+		  -lbsm $(PASSWD_LIBS)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    54
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    55
 CMD_LIBS	= $(LIBS) $(X_LIBS) \
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    56
 		  $(X_PRE_LIBS) -lX11 -lXext $(X_EXTRA_LIBS)
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    57
diff --git xscreensaver-5.11/driver/passwd-pam.c xscreensaver-5.11/driver/passwd-pam.c
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    58
--- xscreensaver-5.11/driver/passwd-pam.c
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    59
+++ xscreensaver-5.11/driver/passwd-pam.c
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    60
@@ -47,6 +47,8 @@
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    61
 
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    62
 #ifdef __sun
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    63
 # include <deflt.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    64
+# include <bsm/adt.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    65
+# include <bsm/adt_event.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    66
 #endif
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    67
 
18044
c733815d6bee * patches/xscreensaver-06-gtk-lock.diff,
alanc
parents: 18039
diff changeset
    68
 extern char *blurb(void);
18124
ac2b6be91df8 2010-06-15 Alan Coopersmith <[email protected]>
alanc
parents: 18077
diff changeset
    69
@@ -81,6 +83,9 @@ extern void unblock_sigchld (void);
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    70
 #undef countof
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    71
 #define countof(x) (sizeof((x))/sizeof(*(x)))
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    72
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    73
+static struct pam_response *reply = 0; /*making it global so we can free it */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    74
+static int replies = 0;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    75
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    76
 /* Some time between Red Hat 4.2 and 7.0, the words were transposed 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    77
    in the various PAM_x_CRED macro names.  Yay!
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    78
  */
18124
ac2b6be91df8 2010-06-15 Alan Coopersmith <[email protected]>
alanc
parents: 18077
diff changeset
    79
@@ -178,6 +183,124 @@ Bool pam_priv_init (int argc, char **argv, Bool verbose_p);
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    80
  */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    81
 static void *suns_pam_implementation_blows = 0;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    82
 
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
    83
+#ifdef __sun
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    84
+#include <syslog.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    85
+#include <bsm/adt.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    86
+#include <bsm/adt_event.h>
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    87
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    88
+static Bool audit_flag_global = True;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    89
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    90
+/*
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    91
+ * audit_lock - audit entry to screenlock
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    92
+ *
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    93
+ *      Entry   Process running with appropriate privilege to generate
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    94
+ *                      audit records and real uid of the user.
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    95
+ *
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    96
+ *      Exit    ADT_screenlock audit record written.
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    97
+ */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    98
+void
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
    99
+audit_lock(void)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   100
+{
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   101
+  adt_session_data_t      *ah;          /* audit session handle */
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   102
+  adt_event_data_t        *event;       /* audit event handle */
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   103
+
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   104
+  /* Audit start of screen lock -- equivalent to logout ;-) */
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   105
+  if (adt_start_session(&ah, NULL, ADT_USE_PROC_DATA) != 0)
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   106
+    {
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   107
+      syslog(LOG_AUTH | LOG_ALERT, "adt_start_session: %m");
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   108
+      return;
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   109
+    }
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   110
+  if ((event = adt_alloc_event(ah, ADT_screenlock)) == NULL)
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   111
+    {
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   112
+      syslog(LOG_AUTH | LOG_ALERT, "adt_alloc_event(ADT_screenlock): %m");
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   113
+    } else {
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   114
+      if (adt_put_event(event, ADT_SUCCESS, ADT_SUCCESS) != 0)
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   115
+        {
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   116
+          syslog(LOG_AUTH | LOG_ALERT, "adt_put_event(ADT_screenlock): %m");
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   117
+        }
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   118
+      adt_free_event(event);
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   119
+    }
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   120
+  (void) adt_end_session(ah);
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   121
+}
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   122
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   123
+/*
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   124
+ * audit_unlock - audit screen unlock
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   125
+ *
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   126
+ *      Entry   Process running with appropriate privilege to generate
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   127
+ *                      audit records and real uid of the user.
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   128
+ *              pam_status = PAM error code; reason for failure.
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   129
+ *
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   130
+ *      Exit    ADT_screenunlock audit record written.
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   131
+ */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   132
+static void
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   133
+audit_unlock(int pam_status)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   134
+{
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   135
+  adt_session_data_t      *ah;          /* audit session handle */
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   136
+  adt_event_data_t        *event;       /* audit event handle */
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   137
+
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   138
+  if (adt_start_session(&ah, NULL, ADT_USE_PROC_DATA) != 0)
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   139
+    {
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   140
+      syslog(LOG_AUTH | LOG_ALERT,
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   141
+             "adt_start_session(ADT_screenunlock): %m");
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   142
+      return;
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   143
+    }
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   144
+  if ((event = adt_alloc_event(ah, ADT_screenunlock)) == NULL)
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   145
+    {
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   146
+      syslog(LOG_AUTH | LOG_ALERT,
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   147
+             "adt_alloc_event(ADT_screenunlock): %m");
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   148
+    } else {
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   149
+      if (adt_put_event(event,
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   150
+                        pam_status == PAM_SUCCESS ? ADT_SUCCESS : ADT_FAILURE,
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   151
+                        pam_status == PAM_SUCCESS ? ADT_SUCCESS
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   152
+                                                  : ADT_FAIL_PAM + pam_status)
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   153
+          != 0)
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   154
+        {
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   155
+          syslog(LOG_AUTH | LOG_ALERT,
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   156
+                 "adt_put_event(ADT_screenunlock(%s): %m",
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   157
+                 pam_strerror(NULL, pam_status));
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   158
+        }
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   159
+      adt_free_event(event);
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   160
+    }
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   161
+  (void) adt_end_session(ah);
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   162
+}
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   163
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   164
+/*
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   165
+ * audit_passwd - audit password change
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   166
+ *      Entry   Process running with appropriate privilege to generate
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   167
+ *                      audit records and real uid of the user.
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   168
+ *              pam_status = PAM error code; reason for failure.
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   169
+ *
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   170
+ *      Exit    ADT_passwd audit record written.
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   171
+ */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   172
+static void
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   173
+audit_passwd(int pam_status)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   174
+{
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   175
+  adt_session_data_t      *ah;          /* audit session handle */
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   176
+  adt_event_data_t        *event;       /* audit event handle */
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   177
+
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   178
+  if (adt_start_session(&ah, NULL, ADT_USE_PROC_DATA) != 0)
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   179
+    {
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   180
+      syslog(LOG_AUTH | LOG_ALERT, "adt_start_session(ADT_passwd): %m");
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   181
+      return;
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   182
+    }
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   183
+  if ((event = adt_alloc_event(ah, ADT_passwd)) == NULL)
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   184
+    {
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   185
+      syslog(LOG_AUTH | LOG_ALERT, "adt_alloc_event(ADT_passwd): %m");
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   186
+    } else {
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   187
+      if (adt_put_event(event,
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   188
+                        pam_status == PAM_SUCCESS ? ADT_SUCCESS : ADT_FAILURE,
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   189
+                        pam_status == PAM_SUCCESS ? ADT_SUCCESS
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   190
+                                                  : ADT_FAIL_PAM + pam_status)
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   191
+          != 0)
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   192
+        {
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   193
+          syslog(LOG_AUTH | LOG_ALERT, "adt_put_event(ADT_passwd(%s): %m",
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   194
+                 pam_strerror(NULL, pam_status));
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   195
+        }
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   196
+      adt_free_event(event);
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   197
+    }
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   198
+  (void) adt_end_session(ah);
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   199
+}
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   200
+#endif /* sun */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   201
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   202
 /**
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   203
  * This function is the PAM conversation driver. It conducts a full
18124
ac2b6be91df8 2010-06-15 Alan Coopersmith <[email protected]>
alanc
parents: 18077
diff changeset
   204
@@ -231,6 +354,12 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   205
     fprintf (stderr, "%s: pam_start (\"%s\", \"%s\", ...) ==> %d (%s)\n",
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   206
              blurb(), service, si->user,
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   207
              status, PAM_STRERROR (pamh, status));
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   208
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   209
+#ifdef __sun
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   210
+  if (audit_flag_global) /* We want one audit lock log per lock */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   211
+    audit_lock ();
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   212
+#endif /**sun*/
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   213
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   214
   if (status != PAM_SUCCESS) goto DONE;
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   215
 
18124
ac2b6be91df8 2010-06-15 Alan Coopersmith <[email protected]>
alanc
parents: 18077
diff changeset
   216
 #ifdef __sun
21473
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   217
@@ -307,22 +436,27 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   218
 # endif /* HAVE_SIGTIMEDWAIT */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   219
   unblock_sigchld();
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   220
 
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   221
+#ifdef __sun
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   222
+  audit_unlock(pam_auth_status);
18039
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   223
+  if (pam_auth_status == PAM_SUCCESS)
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   224
+    audit_flag_global = True;
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   225
+  else
93dd6ed68b16 2010-05-26 Alan Coopersmith <[email protected]>
alanc
parents: 18027
diff changeset
   226
+    audit_flag_global = False;
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   227
+#endif /*sun*/
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   228
+
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   229
 #ifdef HAVE_XSCREENSAVER_LOCK
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   230
   /* Send status message to unlock dialog */
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   231
   if (pam_auth_status == PAM_SUCCESS)
21473
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   232
     {
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   233
-      write_to_child (si, "ul_ok", PAM_STRERROR (pamh, pam_auth_status));
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   234
       if (verbose_p)
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   235
-        sleep (1);
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   236
+        write_to_child (si, "ul_ok", PAM_STRERROR (pamh, pam_auth_status));
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   237
     }
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   238
   else if (si->unlock_state != ul_cancel && si->unlock_state != ul_time)
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   239
     {
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   240
       write_to_child (si, "ul_fail", PAM_STRERROR (pamh, pam_auth_status));
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   241
-      if (verbose_p)
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   242
-        sleep (1);
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   243
-      else
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   244
-        usleep (500000); /* sleep for 1/2 of sec */
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   245
     }
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   246
+  if (verbose_p)
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   247
+    sleep (1);
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   248
 #endif
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   249
 
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   250
   if (verbose_p)
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   251
@@ -352,9 +486,19 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   252
 #ifdef HAVE_XSCREENSAVER_LOCK
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   253
       /* Send status message to unlock dialog ***/
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   254
       if (acct_rc == PAM_SUCCESS)
21473
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   255
-        write_to_child (si, "ul_acct_ok", PAM_STRERROR(pamh, acct_rc));
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   256
+        {
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   257
+          if (verbose_p)
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   258
+            write_to_child (si, "ul_acct_ok", PAM_STRERROR(pamh, acct_rc));
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   259
+        }
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   260
       else
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   261
-        write_to_child (si, "ul_acct_fail", PAM_STRERROR(pamh, acct_rc));
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   262
+        {
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   263
+#ifdef __sun
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   264
+          /* Only in failure of pam_acct_mgmt case we call audit */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   265
+          audit_unlock (acct_rc);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   266
+#endif /*sun*/
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   267
+
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   268
+          write_to_child (si, "ul_acct_fail", PAM_STRERROR(pamh, acct_rc));
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   269
+        }
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   270
       if (verbose_p)
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   271
         sleep (1);
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   272
 #endif
18124
ac2b6be91df8 2010-06-15 Alan Coopersmith <[email protected]>
alanc
parents: 18077
diff changeset
   273
@@ -383,6 +527,10 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   274
             fprintf (stderr, "%s: pam_chauthtok (...) ==> %d (%s)\n",
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   275
                      blurb(), chauth_rc, PAM_STRERROR(pamh, chauth_rc));
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   276
 
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   277
+#ifdef __sun
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   278
+          audit_passwd (chauth_rc);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   279
+#endif /* sun */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   280
+
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   281
           if (chauth_rc != PAM_SUCCESS)
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   282
             {
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   283
               pam_auth_status = chauth_rc;
21473
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   284
@@ -414,9 +562,18 @@ pam_try_unlock(saver_info *si, Bool verbose_p,
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   285
 #ifdef HAVE_XSCREENSAVER_LOCK
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   286
       /* Send status message to unlock dialog ***/
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   287
       if (setcred_rc == PAM_SUCCESS)
21473
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   288
-        write_to_child (si, "ul_setcred_ok", PAM_STRERROR(pamh, setcred_rc));
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   289
+        {
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   290
+          if (verbose_p)
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   291
+            write_to_child (si, "ul_setcred_ok", PAM_STRERROR(pamh, setcred_rc));
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   292
+        }
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   293
       else
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   294
-        write_to_child (si, "ul_setcred_fail", PAM_STRERROR(pamh, setcred_rc));
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   295
+        {
18027
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   296
+#ifdef __sun
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   297
+          /* Only in failure of pam_setcred() case we call audit. */
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   298
+          audit_unlock (setcred_rc);
aecb9b8c6ef2 2010-05-25 Brian Cameron <[email protected]>
yippi
parents:
diff changeset
   299
+#endif /*sun*/
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   300
+          write_to_child (si, "ul_setcred_fail", PAM_STRERROR(pamh, setcred_rc));
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   301
+        }
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   302
       if (verbose_p)
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   303
         sleep (1);
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   304
 #endif
21473
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   305
diff --git xscreensaver-5.11/driver/passwd.c xscreensaver-5.11/driver/passwd.c
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   306
--- xscreensaver-5.11/driver/passwd.c
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   307
+++ xscreensaver-5.11/driver/passwd.c
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   308
@@ -79,9 +79,11 @@ extern void pam_try_unlock (saver_info *si, Bool verbose_p,
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   309
 extern Bool ext_priv_init (int argc, char **argv, Bool verbose_p);
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   310
 extern Bool ext_passwd_valid_p (const char *typed_passwd, Bool verbose_p);
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   311
 #endif
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   312
+#ifndef __sun /* Only use PAM on Solaris, not direct getpwent */
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   313
 extern Bool pwent_lock_init (int argc, char **argv, Bool verbose_p);
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   314
 extern Bool pwent_priv_init (int argc, char **argv, Bool verbose_p);
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   315
 extern Bool pwent_passwd_valid_p (const char *typed_passwd, Bool verbose_p);
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   316
+#endif
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   317
 
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   318
 Bool lock_priv_init (int argc, char **argv, Bool verbose_p);
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   319
 Bool lock_init (int argc, char **argv, Bool verbose_p);
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   320
@@ -105,8 +107,10 @@ struct auth_methods methods[] = {
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   321
   { "external",		0, ext_priv_init, ext_passwd_valid_p, 0,
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   322
   			False, False },
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   323
 # endif
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   324
+# ifndef __sun /* Only use PAM on Solaris, not direct getpwent */
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   325
   { "normal",           pwent_lock_init, pwent_priv_init, pwent_passwd_valid_p, 0,
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   326
                         False, False }
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   327
+# endif
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   328
 };
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   329
 
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   330
 
8a5e3434934f Updated xscreensaver-14-pam_audit.diff to fix bug screensaver continues to accept old password. Bug 7008058
akumrao
parents: 18124
diff changeset
   331
1.7.3.2
18061
1ad14cf3c086 2010-06-01 Alan Coopersmith <[email protected]>
alanc
parents: 18045
diff changeset
   332