OSSP CVS Repository

ossp - Difference in ossp-pkg/shtool/sh.echo versions 1.34 and 1.35
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/shtool/sh.echo 1.34 -> 1.35

--- sh.echo      2003/02/21 19:18:34     1.34
+++ sh.echo      2003/02/22 12:27:20     1.35
@@ -141,14 +141,18 @@
                 userid=`echo $str | sed -e 's/^uid[     ]*=[    ]*//' -e 's/(.*$//'`
             fi
             if [ ".$userid" = . ]; then
-                userid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \
+                userid=`(getent passwd ${username}) 2>/dev/null | \
                         sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
                 if [ ".$userid" = . ]; then
-                    userid=`(ypcat passwd) 2>/dev/null |
-                            egrep "^${username}:" | \
+                    userid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \
                             sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
                     if [ ".$userid" = . ]; then
-                        userid='?'
+                        userid=`(ypcat passwd) 2>/dev/null |
+                                egrep "^${username}:" | \
+                                sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
+                        if [ ".$userid" = . ]; then
+                            userid='?'
+                        fi
                     fi
                 fi
             fi
@@ -166,13 +170,17 @@
             groupid=`echo $str | sed -e 's/^.*gid[      ]*=[    ]*//' -e 's/(.*$//'`
         fi
         if [ ".$groupid" = . ]; then
-            groupid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \
+            groupid=`(getent passwd ${username}) 2>/dev/null | \
                      sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
             if [ ".$groupid" = . ]; then
-                groupid=`(ypcat passwd) 2>/dev/null | egrep "^${username}:" | \
+                groupid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \
                          sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
                 if [ ".$groupid" = . ]; then
-                    groupid='?'
+                    groupid=`(ypcat passwd) 2>/dev/null | egrep "^${username}:" | \
+                             sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
+                    if [ ".$groupid" = . ]; then
+                        groupid='?'
+                    fi
                 fi
             fi
         fi
@@ -189,14 +197,19 @@
             groupname=`echo $str | sed -e 's/^.*gid[    ]*=[    ]*[0-9]*(//' -e 's/).*$//'`
         fi
         if [ ".$groupname" = . ]; then
-            groupname=`egrep "^[^:]*:[^:]*:${groupid}:" /etc/group 2>/dev/null | \
+            groupname=`(getent group) 2>/dev/null | \
+                       egrep "^[^:]*:[^:]*:${groupid}:" | \
                        sed -e 's/:.*$//'`
             if [ ".$groupname" = . ]; then
-                groupname=`(ypcat group) 2>/dev/null | \
-                           egrep "^[^:]*:[^:]*:${groupid}:" | \
+                groupname=`egrep "^[^:]*:[^:]*:${groupid}:" /etc/group 2>/dev/null | \
                            sed -e 's/:.*$//'`
                 if [ ".$groupname" = . ]; then
-                    groupname='?'
+                    groupname=`(ypcat group) 2>/dev/null | \
+                               egrep "^[^:]*:[^:]*:${groupid}:" | \
+                               sed -e 's/:.*$//'`
+                    if [ ".$groupname" = . ]; then
+                        groupname='?'
+                    fi
                 fi
             fi
         fi

CVSTrac 2.0.1