OSSP CVS Repository

ossp - Check-in [3396]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 3396
Date: 2003-May-28 16:25:56 (local)
2003-May-28 14:25:56 (UTC)
User:ms
Branch:
Comment: Bug fix user id parsing on linux, and put strip block back in.
Tickets:
Inspections:
Files:
ossp-pkg/rc/rc_script.c      1.27 -> 1.28     6 inserted, 3 deleted

ossp-pkg/rc/rc_script.c 1.27 -> 1.28

--- rc_script.c  2003/05/28 13:31:55     1.27
+++ rc_script.c  2003/05/28 14:25:56     1.28
@@ -215,7 +215,8 @@
             strncpy(szTemp, piStart, piEnd - piStart + 1);
             piSubtemp = strstr(szTemp, RC_DEF_PRG);
             if (piSubtemp) { /* Priority pattern found */
-                nTmp = (int)piSubtemp + strlen(RC_DEF_PRG);
+                for (nTmp = (int)piSubtemp + strlen(RC_DEF_PRG); \
+                    isspace(*(char *)nTmp); nTmp += sizeof (char)); /* Strip */
                 nPri = strtol((char *)nTmp, &piSep, 10);
                 if ((char *)nTmp == piSep)  /* No priority number follows */
                     RC_THROW(RC_ERR_USE);   /* which is an error */
@@ -228,11 +229,13 @@
             /* Handle the section userid   */
             piSubtemp = strstr(szTemp, RC_DEF_UIG);
             if (piSubtemp) { /* Userid pattern found */
-                nTmp = (int)piSubtemp + strlen(RC_DEF_UIG);
+                for (nTmp = (int)piSubtemp + strlen(RC_DEF_UIG); \
+                    isspace(*(char *)nTmp); nTmp += sizeof (char)); /* Strip */
                 nUid = strtol((char *)nTmp, &piSep, 10);
                 if ((char *)nTmp == piSep)      /* No userid number follows */
                 {
-                    nUserbytes = (strcspn(piSep, " \t\n") + sizeof (char)) * sizeof (char);
+                    nUserbytes = strspn((strcspn(piSep, " \t\n") * sizeof (char) + piSep), " \t\n");
+                    nUserbytes = (strlen(piSep) - nUserbytes + 1) * sizeof (char);
                     szUser = malloc(nUserbytes);
                     if (!szUser)
                         RC_THROW(RC_ERR_MEM);

CVSTrac 2.0.1