Index: ossp-pkg/rc/00TODO RCS File: /v/ossp/cvs/ossp-pkg/rc/00TODO,v rcsdiff -q -kk '-r1.41' '-r1.42' -u '/v/ossp/cvs/ossp-pkg/rc/00TODO,v' 2>/dev/null --- 00TODO 2003/05/21 12:49:20 1.41 +++ 00TODO 2003/05/21 15:16:41 1.42 @@ -28,7 +28,6 @@ Document Refs, pri, user, group, ci, go only in normal (not special) sections. Section definition regular expressions need to follow a format ()\2. - Changed from OpenPKG: temp files no longer have pids in their file names Questions Should location regex specify a directory and prefix separately, or files*? @@ -37,6 +36,7 @@ Variation to OpenPKG rc OpenPKG puts sections with no -p at end, but we give them implicitly -p 200 + Temp files no longer have pids in their file names during eval mode Consider Nice to have feature for ex, a pEx->pObj->strErr(pEx->Value); Index: ossp-pkg/rc/rc_proc.c RCS File: /v/ossp/cvs/ossp-pkg/rc/rc_proc.c,v rcsdiff -q -kk '-r1.29' '-r1.30' -u '/v/ossp/cvs/ossp-pkg/rc/rc_proc.c,v' 2>/dev/null --- rc_proc.c 2003/05/21 12:49:21 1.29 +++ rc_proc.c 2003/05/21 15:16:41 1.30 @@ -224,9 +224,15 @@ else ppSectmp[nRcs] = NULL; } - qsort((void *)ppSectmp, (size_t)pRc->m_pAnal->m_nRcs, sizeof(rc_section_t *), priCompare); + qsort((void *)ppSectmp, (size_t)pRc->m_pAnal->m_nRcs, \ + sizeof(rc_section_t *), priCompare); nTmp = 0; while (nTmp < pRc->m_pAnal->m_nRcs && ppSectmp[nTmp]) { + if ((szTmp = (char *)sectionGetlogin(ppSectmp[nTmp])) != NULL) { + scriptAppend(pFatscript, "#su ", strlen("#su ")); + scriptAppend(pFatscript, szTmp, strlen(szTmp)); + scriptAppend(pFatscript, "\n", strlen("\n") + 1); + } szTmp = (char *)sectionGetdata(ppSectmp[nTmp]); scriptAppend(pFatscript, szTmp, strlen(szTmp) + 1); nTmp++; @@ -238,8 +244,12 @@ szTmpfile = (char *)configGetval(RC_TMP_VAL); nTmpname = (strlen(szTmpfile) + strlen(RC_EVL_TMP) + \ strlen(RC_EVL_SUF) + 1) * sizeof(char); + if (*(szTmpfile + (strlen(szTmpfile) - 1) * sizeof(char)) != '/') + nTmpname += sizeof(char); szTmpfile = malloc(nTmpname); strcpy(szTmpfile, configGetval(RC_TMP_VAL)); + if (*(szTmpfile + (strlen(szTmpfile) - 1) * sizeof(char)) != '/') + *(szTmpfile + (strlen(szTmpfile)) * sizeof(char)) = '/'; strcat(szTmpfile, RC_EVL_TMP); mktemp(szTmpfile); strcat(szTmpfile, RC_EVL_SUF); Index: ossp-pkg/rc/rc_script.c RCS File: /v/ossp/cvs/ossp-pkg/rc/rc_script.c,v rcsdiff -q -kk '-r1.19' '-r1.20' -u '/v/ossp/cvs/ossp-pkg/rc/rc_script.c,v' 2>/dev/null --- rc_script.c 2003/05/21 12:49:21 1.19 +++ rc_script.c 2003/05/21 15:16:41 1.20 @@ -50,7 +50,10 @@ pNew = (rc_script_t *)malloc(sizeof(rc_script_t)); *pNew = malloc((strlen(scriptTostring(pOrig)) + 1) * sizeof(char)); - strcpy(*pNew, scriptTostring(pOrig)); + if (pNew) + strcpy(*pNew, scriptTostring(pOrig)); + else + RC_THROW(RC_ERR_MEM); return(pNew); } @@ -224,7 +227,7 @@ /* Handle the section userid */ piSubtemp = strnstr(piStart, RC_DEF_UIG, piEnd - piStart); if (piSubtemp) { /* Userid pattern found */ - for (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 */ @@ -312,17 +315,24 @@ rc_return_t scriptWrite(rc_script_t *pScript, const char *szPath) { int nFdtmp = open(szPath, O_WRONLY | O_CREAT, 0600); - FILE *pStream = fdopen(nFdtmp, "w"); + FILE *pStream = NULL; + + /* Initial sanity checks */ + if (!pScript || nFdtmp < 0) + return(RC_THROW(RC_ERR_USE)); + else + pStream = fdopen(nFdtmp, "w"); /* Don't remove this! It encapsulates the script object, */ /* which might not be a simple string */ - if (pScript && pStream) { + if (pStream) { fprintf(pStream, "%s", *pScript); fclose(pStream); return(RC_THROW(RC_OK)); } else - return(RC_THROW(RC_ERR_USE)); + fprintf(stderr, "FIXME: Replace with a real ex_throw!\n"); +/* return(RC_THROW(RC_ERR_USE));*/ } /************************************************ Index: ossp-pkg/rc/rc_sect.c RCS File: /v/ossp/cvs/ossp-pkg/rc/rc_sect.c,v rcsdiff -q -kk '-r1.9' '-r1.10' -u '/v/ossp/cvs/ossp-pkg/rc/rc_sect.c,v' 2>/dev/null --- rc_sect.c 2003/05/21 12:49:21 1.9 +++ rc_sect.c 2003/05/21 15:16:41 1.10 @@ -226,8 +226,11 @@ ************************************************/ rc_return_t sectionDump(rc_section_t *pSec) { + const char *szLogin = NULL; + if (pSec) { - fprintf(stdout, "#su %s\n", sectionGetlogin(pSec)); + if ((szLogin = sectionGetlogin(pSec)) != NULL) + fprintf(stdout, "#su %s\n", szLogin); fprintf(stdout, "%s", sectionGetdata(pSec)); return(RC_THROW(RC_OK)); } @@ -242,9 +245,15 @@ rc_return_t sectionWrite(rc_section_t *pSec, const char *szPath) { int nFdtmp = open(szPath, O_WRONLY | O_CREAT, 0600); - FILE *pStream = fdopen(nFdtmp, "w"); + FILE *pStream = NULL; + + /* Initial sanity checks */ + if (!pSec || nFdtmp < 0) + return(RC_THROW(RC_ERR_USE)); + else + pStream = fdopen(nFdtmp, "w"); - if (pSec && pStream) { + if (pStream) { fprintf(pStream, "#su %s\n", sectionGetlogin(pSec)); fprintf(pStream, "%s", sectionGetdata(pSec)); fclose(pStream); Index: ossp-pkg/rc/rc_test/rc.samba RCS File: /v/ossp/cvs/ossp-pkg/rc/rc_test/rc.samba,v rcsdiff -q -kk '-r1.2' '-r1.3' -u '/v/ossp/cvs/ossp-pkg/rc/rc_test/rc.samba,v' 2>/dev/null --- rc.samba 2003/05/15 12:47:26 1.2 +++ rc.samba 2003/05/21 15:16:44 1.3 @@ -8,7 +8,7 @@ %search whois cyvaned.com -%destroy +%destroy -u sw-n ldd /usr/lib/libpcap.so %finish