]> git.ozlabs.org Git - ppp.git/commitdiff
Fixed uninitialized 'pw' variable in HAS_SHADOW logic in session.c due
authorJames Carlson <carlsonj@workingcode.com>
Wed, 30 Jan 2008 14:26:53 +0000 (14:26 +0000)
committerJames Carlson <carlsonj@workingcode.com>
Wed, 30 Jan 2008 14:26:53 +0000 (14:26 +0000)
to flaw in initial integration.  Enabled HAS_SHADOW for Solaris, which
always has shadow password files.  Fixed all of pppd to compile with gcc
-Wall on Solaris.  (Still need fixes for kernel modules; blocking
Makedefs.gcc update.)  Tested with and without PAM, with gcc and Sun's
cc.

pppd/Makefile.sol2
pppd/session.c
pppd/sys-solaris.c

index 49e73c7f07920f32334992ccbd856d8c76df819c..1ad4b139d3fb10b3b03f5293776483a526ca21ff 100644 (file)
@@ -1,6 +1,6 @@
 #
 # Makefile for pppd under Solaris 2.
-# $Id: Makefile.sol2,v 1.29 2007/12/01 20:10:51 carlsonj Exp $
+# $Id: Makefile.sol2,v 1.30 2008/01/30 14:26:52 carlsonj Exp $
 #
 
 include ../Makedefs.com
@@ -12,8 +12,11 @@ OBJS =  main.o magic.o fsm.o lcp.o ipcp.o upap.o chap-new.o eap.o md5.o \
        tty.o ccp.o ecp.o auth.o options.o demand.o utils.o sys-solaris.o \
        chap-md5.o session.o
 
+# Solaris uses shadow passwords
+CFLAGS += -DHAS_SHADOW
+
 #
-# uncomment the following to enable plugins
+# Comment the following out to disable plugins
 #
 CFLAGS += -DPLUGIN
 LIBS   += -ldl
index f9f8fc011b1b27b3098a80cec3364dfa9f2bc910..491d3bfaac11c79791f5fd3eba2628aa89397a4a 100644 (file)
@@ -294,9 +294,11 @@ session_start(flags, user, passwd, ttyName, msg)
 #else /* #ifdef USE_PAM */
 
 /*
- * Use the non-PAM methods directly
+ * Use the non-PAM methods directly.  'pw' will remain NULL if the user
+ * has not been authenticated using local UNIX system services.
  */
 
+    pw = NULL;
     if ((SESS_AUTH & flags)) {
        pw = getpwnam(user);
 
@@ -362,7 +364,12 @@ session_start(flags, user, passwd, ttyName, msg)
        logged_in = 1;
 
 #if defined(_PATH_LASTLOG) && !defined(USE_PAM)
-       {
+       /*
+        * Enter the user in lastlog only if he has been authenticated using
+        * local system services.  If he has not, then we don't know what his
+        * UID might be, and lastlog is indexed by UID.
+        */
+       if (pw != NULL) {
             struct lastlog ll;
             int fd;
 
index 06e8f733a9c52447ef2de5ee8b2493de2450ed28..50ce3dfac2d39a28e1ba26a3e5175f6bc0a73388 100644 (file)
@@ -85,7 +85,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define RCSID  "$Id: sys-solaris.c,v 1.15 2007/06/19 02:08:35 carlsonj Exp $"
+#define RCSID  "$Id: sys-solaris.c,v 1.16 2008/01/30 14:26:53 carlsonj Exp $"
 
 #include <limits.h>
 #include <stdio.h>
@@ -2220,7 +2220,7 @@ get_hw_addr_dlpi(name, hwaddr)
     char *name;
     struct sockaddr *hwaddr;
 {
-    char *p, *q;
+    char *q;
     int unit, iffd, adrlen;
     unsigned char *adrp;
     char ifdev[24];
@@ -2744,7 +2744,6 @@ get_pty(master_fdp, slave_fdp, slave_name, uid)
 {
     int mfd, sfd;
     char *pty_name;
-    struct termios tios;
 
     mfd = open("/dev/ptmx", O_RDWR);
     if (mfd < 0) {