OSSP CVS Repository

ossp - Difference in ossp-pkg/rc/rc_sect.c versions 1.4 and 1.5
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/rc/rc_sect.c 1.4 -> 1.5

--- rc_sect.c    2003/05/15 12:49:11     1.4
+++ rc_sect.c    2003/05/15 22:22:30     1.5
@@ -61,11 +61,11 @@
 
     /* Today is a rain and no coffee day */
     pSec = (rc_section_t *)malloc(sizeof(rc_section_t));
-    pSec->nPri   = pOrigsec->nPri;
-    pSec->nUid   = pOrigsec->nUid;
-    pSec->szData = malloc(strlen(pOrigsec->szData) * sizeof(char) + 1);
-    strcpy(pSec->szData, pOrigsec->szData);
-    pSec->Bytes  = pOrigsec->Bytes;
+    pSec->m_nPri   = pOrigsec->m_nPri;
+    pSec->m_nUid   = pOrigsec->m_nUid;
+    pSec->m_Bytes  = pOrigsec->m_Bytes;
+    pSec->m_szData = malloc(strlen(pOrigsec->m_szData) * sizeof(char) + 1);
+    strcpy(pSec->m_szData, pOrigsec->m_szData);
 
     if (!pSec)
         RC_THROW(RC_ERR_MEM);
@@ -80,7 +80,7 @@
 const int sectionGetpri(rc_section_t *pSec)
 { /* Priority of section, used to order sections during exec|eval|print */
     if (pSec)
-        return(pSec->nPri);
+        return(pSec->m_nPri);
     else
         RC_THROW(RC_ERR_USE);
 
@@ -90,7 +90,7 @@
 const int sectionGetuid(rc_section_t *pSec)
 { /* Userid of section, used with setuid during exec or eval */
     if (pSec)
-        return(pSec->nUid);
+        return(pSec->m_nUid);
     else
         RC_THROW(RC_ERR_USE);
 
@@ -99,8 +99,8 @@
 
 const char *sectionGetdata(rc_section_t *pSec)
 { /* Data of section, this is the script body of the particular section */
-    if (pSec && pSec->szData)
-        return(pSec->szData);
+    if (pSec && pSec->m_szData)
+        return(pSec->m_szData);
     else
         RC_THROW(RC_ERR_USE);
 
@@ -110,7 +110,7 @@
 size_t sectionGetlen(rc_section_t *pSec)
 { /* Data length of section, length of a script body of a particular section */
     if (pSec)
-        return(pSec->Bytes);
+        return(pSec->m_Bytes);
     else
         RC_THROW(RC_ERR_USE);
 
@@ -124,7 +124,7 @@
 rc_return_t sectionSetpri(rc_section_t *pSec, long nPriority)
 { /* Priority of section, used to order sections during exec|eval|print */
     if (pSec) {
-        pSec->nPri = nPriority;
+        pSec->m_nPri = nPriority;
         return(RC_THROW(RC_OK));
     }
 
@@ -134,7 +134,7 @@
 rc_return_t sectionSetuid(rc_section_t *pSec, long nUserid)
 { /* Userid of section, used with setuid during exec or eval */
     if (pSec) {
-        pSec->nUid = nUserid;
+        pSec->m_nUid = nUserid;
         return(RC_THROW(RC_OK));
     }
 
@@ -144,15 +144,15 @@
 rc_return_t sectionSetdata(rc_section_t *pSec, const char *kszScript)
 { /* Data of section, this is the script body of the particular section */
     if (pSec) {
-        pSec->Bytes = strlen(kszScript) * sizeof(char) + sizeof(char);
-        if (pSec->szData) { /* The section data is already in use */
-            free(pSec->szData);
-            pSec->szData = malloc(pSec->Bytes);
-            strcpy(pSec->szData, kszScript);
+        pSec->m_Bytes = strlen(kszScript) * sizeof(char) + sizeof(char);
+        if (pSec->m_szData) { /* The section data is already in use */
+            free(pSec->m_szData);
+            pSec->m_szData = malloc(pSec->m_Bytes);
+            strcpy(pSec->m_szData, kszScript);
         }
         else { /* Set the data the usual way */
-            pSec->szData = malloc(pSec->Bytes);
-            strcpy(pSec->szData, kszScript);
+            pSec->m_szData = malloc(pSec->m_Bytes);
+            strcpy(pSec->m_szData, kszScript);
         }
         return(RC_THROW(RC_OK));
     }
@@ -163,17 +163,17 @@
 rc_return_t sectionSetndata(rc_section_t *pSec, const char *kszScript, size_t Len)
 { /* Data of section, this is the script body of the particular section */
     if (pSec) {
-        pSec->Bytes = Len * sizeof(char) + sizeof(char); /* Set size */
-        if (pSec->szData) { /* The section data is already in use */
-            free(pSec->szData);
-            pSec->szData = malloc(pSec->Bytes);
-            strncpy(pSec->szData, kszScript, Len);
-            *(pSec->szData + Len) = NULL; /* Terminate outgoing */
+        pSec->m_Bytes = Len * sizeof(char) + sizeof(char); /* Set size */
+        if (pSec->m_szData) { /* The section data is already in use */
+            free(pSec->m_szData);
+            pSec->m_szData = malloc(pSec->m_Bytes);
+            strncpy(pSec->m_szData, kszScript, Len);
+            *(pSec->m_szData + Len) = NULL; /* Terminate outgoing */
         }
         else { /* Set the data the usual way */
-            pSec->szData = malloc(pSec->Bytes);
-            strncpy(pSec->szData, kszScript, Len);
-            *(pSec->szData + Len) = NULL; /* Terminate outgoing */
+            pSec->m_szData = malloc(pSec->m_Bytes);
+            strncpy(pSec->m_szData, kszScript, Len);
+            *(pSec->m_szData + Len) = NULL; /* Terminate outgoing */
         }
         return(RC_THROW(RC_OK));
     }
@@ -187,8 +187,6 @@
 ************************************************/
 rc_return_t sectionDump(rc_section_t *pSec)
 {
-    /* Don't remove this! It encapsulates the script object, */
-    /*                    which might not be a simple string */
     if (pSec) {
         fprintf(stdout, "%s", sectionGetdata(pSec));
         return(RC_THROW(RC_OK));
@@ -205,8 +203,8 @@
 {
     /* Cleanup our junk */
     if (pSec) {
-        if (pSec->szData)
-            free(pSec->szData);
+        if (pSec->m_szData)
+            free(pSec->m_szData);
         free(pSec);
     }
     else    /* Dumbass passed an empty section object */

CVSTrac 2.0.1