head 1.20;
access;
symbols
OSSP_RC_0_7_3:1.20
OSSP_RC_0_7_2:1.20
OSSP_RC_0_7_1:1.19
OSSP_RC_ALPHA_06:1.11
OSSP_RC_EXBROKEN:1.10;
locks; strict;
comment @ * @;
1.20
date 2003.07.08.15.09.50; author mlelstv; state Exp;
branches;
next 1.19;
1.19
date 2003.07.07.13.30.51; author ms; state Exp;
branches;
next 1.18;
1.18
date 2003.07.07.12.55.42; author ms; state Exp;
branches;
next 1.17;
1.17
date 2003.06.30.14.43.36; author ms; state Exp;
branches;
next 1.16;
1.16
date 2003.06.27.14.26.13; author ms; state Exp;
branches;
next 1.15;
1.15
date 2003.06.26.18.45.14; author ms; state Exp;
branches;
next 1.14;
1.14
date 2003.06.18.14.35.29; author ms; state Exp;
branches;
next 1.13;
1.13
date 2003.06.13.11.50.37; author ms; state Exp;
branches;
next 1.12;
1.12
date 2003.06.11.16.18.48; author ms; state Exp;
branches;
next 1.11;
1.11
date 2003.05.27.13.14.08; author ms; state Exp;
branches;
next 1.10;
1.10
date 2003.05.21.15.16.41; author ms; state Exp;
branches;
next 1.9;
1.9
date 2003.05.21.12.49.21; author ms; state Exp;
branches;
next 1.8;
1.8
date 2003.05.20.15.06.42; author ms; state Exp;
branches;
next 1.7;
1.7
date 2003.05.19.19.03.06; author ms; state Exp;
branches;
next 1.6;
1.6
date 2003.05.16.18.43.31; author ms; state Exp;
branches;
next 1.5;
1.5
date 2003.05.15.22.22.30; author ms; state Exp;
branches;
next 1.4;
1.4
date 2003.05.15.12.49.11; author ms; state Exp;
branches;
next 1.3;
1.3
date 2003.05.14.16.36.28; author ms; state Exp;
branches;
next 1.2;
1.2
date 2003.04.03.12.05.14; author ms; state Exp;
branches;
next 1.1;
1.1
date 2002.08.02.16.38.09; author ms; state Exp;
branches;
next ;
desc
@@
1.20
log
@flush audit comments and changes
@
text
@/* OSSP rc - Run-Command Processor
** Copyright (c) 2002-2003 Ralf S. Engelschall
** Copyright (c) 2002-2003 Cable & Wireless Deutschland GmbH
** Copyright (c) 2002-2003 The OSSP Project
**
** This file is part of OSSP rc, a portable run-command processor
** which can be found at http://www.ossp.org/pkg/lib/rc/
**
** Permission to use, copy, modify, and distribute this software for
** any purpose with or without fee is hereby granted, provided that
** the above copyright notice and this permission notice appear in all
** copies.
**
** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
** SUCH DAMAGE.
**
** rc_sect.c: Run-Command Processor ISO C source file
*/
#include /* For string copy and such data ops */
#include /* For memory ops */
#include /* For mktemp(3) */
#include /* For open(2) */
#include "rc.h" /* Public Rc interface */
/************************************************
* sectionNew(const char *) *
* Construct a section *
************************************************/
rc_section_t *sectionNew(const char *szName)
{
rc_section_t *pSec = NULL;
/* Among other things, they make great coffee at Cable & Wireless */
/* This code would probably have more bugs if the coffee was not as good */
pSec = (rc_section_t *)calloc(1, sizeof(rc_section_t));
if (pSec == NULL)
RC_THROW(RC_ERR_MEM);
pSec->m_szName = malloc((strlen(szName) + 1) * sizeof(char));
strcpy(pSec->m_szName, szName);
pSec->m_pData = scriptNew();
return(pSec);
}
/************************************************
* sectionCopy(rc_section_t *) *
* Opaque copy constructor *
************************************************/
rc_section_t *sectionCopy(rc_section_t *pOrigsec)
{
rc_section_t *pSec = NULL;
/* Today is a rain and no coffee day */
pSec = (rc_section_t *)calloc(1, sizeof(rc_section_t));
pSec->m_nPri = pOrigsec->m_nPri;
pSec->m_nUid = pOrigsec->m_nUid;
/* Deep copy of section name */
if (pOrigsec->m_szName) {
pSec->m_szName = malloc((strlen(pOrigsec->m_szName) + 1)\
* sizeof(char));
strcpy(pSec->m_szName, pOrigsec->m_szName);
}
/* Deep copy of parent name */
if (pOrigsec->m_szParent) {
pSec->m_szParent = malloc((strlen(pOrigsec->m_szParent) + 1)\
* sizeof(char));
strcpy(pSec->m_szParent, pOrigsec->m_szParent);
}
/* Deep copy of user name */
if (pOrigsec->m_szLogin) {
pSec->m_szLogin = malloc((strlen(pOrigsec->m_szLogin) + 1)\
* sizeof(char));
strcpy(pSec->m_szLogin, pOrigsec->m_szLogin);
}
/* Deep copy of section text */
if (scriptGetdata(pOrigsec->m_pData)) {
if (!pSec->m_pData)
pSec->m_pData = scriptNew();
scriptSetdata(pSec->m_pData, scriptGetdata(pOrigsec->m_pData));
}
if (!pSec)
RC_THROW(RC_ERR_MEM);
return(pSec);
}
/************************************************
* sectionGetXXX(rc_section_t *) *
* Accessor methods *
************************************************/
const int sectionGetpri(rc_section_t *pSec)
{ /* Priority of section, used to order sections during exec|eval|print */
if (pSec)
return(pSec->m_nPri);
else
RC_THROW(RC_ERR_USE);
return(0); /* Not reached */
}
const int sectionGetuid(rc_section_t *pSec)
{ /* Userid of section, used with setuid during exec or eval */
if (pSec)
return(pSec->m_nUid);
else
RC_THROW(RC_ERR_USE);
return(0); /* Not reached */
}
const char *sectionGetname(rc_section_t *pSec)
{ /* Name of section, used for display during verbose */
if (pSec)
return(pSec->m_szName);
else
RC_THROW(RC_ERR_USE);
return(0); /* Not reached */
}
const char *sectionGetparent(rc_section_t *pSec)
{ /* Parent rcfile name of section, used for display during verbose */
if (pSec)
return(pSec->m_szParent);
else
RC_THROW(RC_ERR_USE);
return(0); /* Not reached */
}
const char *sectionGetlogin(rc_section_t *pSec)
{ /* User name of section, used for display during print */
if (pSec)
return(pSec->m_szLogin);
else
RC_THROW(RC_ERR_USE);
return(0); /* Not reached */
}
rc_script_t *sectionGetscript(rc_section_t *pSec)
{
if (pSec)
return(pSec->m_pData);
else
RC_THROW(RC_ERR_USE);
return(0); /* Not reached */
}
const char *sectionGetdata(rc_section_t *pSec)
{ /* Data of section, this is the script body of the particular section */
/* ATTENTION: data section may be NULL */
if (pSec) {
const char *kszScriptdata = scriptGetdata(pSec->m_pData);
/* FIXME mlelstv -- why is an empty section NULL ? */
if (kszScriptdata && strlen(kszScriptdata) > 0)
return(kszScriptdata);
else
return NULL;
}
else
RC_THROW(RC_ERR_USE);
return(0); /* Not reached */
}
/************************************************
* sectionSetXXX(rc_section_t *) *
* Accessor methods *
************************************************/
rc_return_t sectionSetpri(rc_section_t *pSec, long nPriority)
{ /* Priority of section, used to order sections during exec|eval|print */
if (pSec) {
pSec->m_nPri = nPriority;
return(RC_THROW(RC_OK));
}
return(RC_THROW(RC_ERR_USE));
}
rc_return_t sectionSetuid(rc_section_t *pSec, long nUserid)
{ /* Userid of section, used with setuid during exec or eval */
if (pSec) {
pSec->m_nUid = nUserid;
return(RC_THROW(RC_OK));
}
return(RC_THROW(RC_ERR_USE));
}
rc_return_t sectionSetname(rc_section_t *pSec, const char *szName)
{ /* Name of section, used for display during verbose */
if (pSec) {
pSec->m_szName = malloc((strlen(szName) + 1) * sizeof (char));
strcpy(pSec->m_szName, szName);
return(RC_THROW(RC_OK));
}
return(RC_THROW(RC_ERR_USE));
}
rc_return_t sectionSetparent(rc_section_t *pSec, const char *szName)
{ /* Parent rcfile name of section, used for display during verbose */
if (pSec) {
pSec->m_szParent = malloc((strlen(szName) + 1) * sizeof (char));
strcpy(pSec->m_szParent, szName);
return(RC_THROW(RC_OK));
}
return(RC_THROW(RC_ERR_USE));
}
rc_return_t sectionSetlogin(rc_section_t *pSec, const char *szLogin)
{ /* User name of section, used for display during print */
if (pSec) {
pSec->m_szLogin = malloc((strlen(szLogin) + 1) * sizeof (char));
strcpy(pSec->m_szLogin, szLogin);
return(RC_THROW(RC_OK));
}
return(RC_THROW(RC_ERR_USE));
}
rc_return_t sectionSetdata(rc_section_t *pSec, const char *kszIn)
{ /* Data of section, this is the script body of the particular section */
assert(pSec && kszIn);
if (scriptGetdata(pSec->m_pData)) { /* The section data is already in use */
scriptDelete(pSec->m_pData);
pSec->m_pData = scriptNew();
}
scriptSetdata(pSec->m_pData, kszIn);
return(RC_THROW(RC_OK));
}
rc_return_t sectionSetndata(rc_section_t *pSec, const char *kszIn, size_t Len)
{ /* Data of section, this is the script body of the particular section */
char *szTemp = NULL;
size_t nBytes = (Len + 1) * sizeof(char); /* Set size */
/* copy data with terminating NUL character */
szTemp = malloc(nBytes);
strncpy(szTemp, kszIn, Len);
*(szTemp + Len) = '\0'; /* Terminate outgoing */
/* FIXME mlelstv -- how to do exception handling ?? */
sectionSetdata(pSec, szTemp); /* Finish the job */
free(szTemp); /* Deallocate */
szTemp = NULL;
return(RC_THROW(RC_OK));
}
/************************************************
* sectionDump(rc_section_t *) *
* Print a section to standard out *
************************************************/
rc_return_t sectionDump(rc_section_t *pSec)
{
const char *szLogin = NULL;
if (pSec) {
if ((szLogin = sectionGetlogin(pSec)) != NULL)
fprintf(stdout, "#su %s\n", szLogin);
fprintf(stdout, "%s", sectionGetdata(pSec));
return(RC_THROW(RC_OK));
}
else
return(RC_THROW(RC_ERR_USE));
}
/************************************************
* sectionWrite(rc_section_t *, const char *) *
* Print a section to a file *
************************************************/
rc_return_t sectionWrite(rc_section_t *pSec, const char *szPath)
{
int nFdtmp = -1;
FILE *pStream = NULL;
/* Parameter sanity checks */
if (!pSec)
return(RC_THROW(RC_ERR_USE));
/* open file with restricted mode 0600 to preserve privacy */
nFdtmp = open(szPath, O_WRONLY | O_CREAT, 0600);
if (nFdtmp < 0)
return(RC_THROW(RC_ERR_USE));
pStream = fdopen(nFdtmp, "w");
if (pStream == NULL) {
close(nFdtmp);
unlink(szPath);
return(RC_THROW(RC_ERR_USE));
}
fprintf(pStream, "#su %s\n", sectionGetlogin(pSec));
fprintf(pStream, "%s", sectionGetdata(pSec));
fclose(pStream);
/* this file is deleted by user, no cleanup necessary */
return(RC_THROW(RC_OK));
}
/************************************************
* sectionDelete(rc_section_t *) *
* Destruct a section *
************************************************/
rc_return_t sectionDelete(rc_section_t *pSec)
{
/* Cleanup our junk */
if (pSec) {
if (pSec->m_pData) {
scriptDelete(pSec->m_pData);
pSec->m_pData = NULL;
}
if (pSec->m_szName) {
free(pSec->m_szName);
pSec->m_szName = NULL;
}
if (pSec->m_szLogin) {
free(pSec->m_szLogin);
pSec->m_szLogin = NULL;
}
free(pSec);
}
else /* Dumbass passed an empty section object */
return(RC_THROW(RC_ERR_USE));
return(RC_THROW(RC_OK));
}
@
1.19
log
@More header corrections and improvements.
@
text
@d49 2
d52 3
a54 7
if (pSec) {
pSec->m_szName = malloc((strlen(szName) + 1) * sizeof(char));
strcpy(pSec->m_szName, szName);
pSec->m_pData = scriptNew();
}
else
RC_THROW(RC_ERR_MEM);
d74 1
a74 1
pSec->m_szName = malloc((strlen(pOrigsec->m_szName) + sizeof(char))\
d81 1
a81 1
pSec->m_szParent = malloc((strlen(pOrigsec->m_szParent) + sizeof(char))\
d88 1
a88 1
pSec->m_szLogin = malloc((strlen(pOrigsec->m_szLogin) + sizeof(char))\
d172 1
d175 1
d251 1
a251 1
pSec->m_pData = NULL;
d264 1
a264 7
assert(pSec && kszIn); /* Dummy detector */
if (pSec->m_pData) { /* The section data is already in use */
scriptDelete(pSec->m_pData);
}
pSec->m_pData = scriptNew();
d268 4
a271 1
scriptSetdata(pSec->m_pData, szTemp); /* Finish the job */
d301 1
a301 1
int nFdtmp = open(szPath, O_WRONLY | O_CREAT, 0600);
d304 7
a310 2
/* Initial sanity checks */
if (!pSec || nFdtmp < 0)
a311 2
else
pStream = fdopen(nFdtmp, "w");
d313 5
a317 5
if (pStream) {
fprintf(pStream, "#su %s\n", sectionGetlogin(pSec));
fprintf(pStream, "%s", sectionGetdata(pSec));
fclose(pStream);
return(RC_THROW(RC_OK));
d319 8
a326 2
else
return(RC_THROW(RC_ERR_USE));
d352 1
a352 1
assert(FALSE);
@
1.18
log
@Correct and update copyrights and source headers.
@
text
@d1 1
a1 1
/* OSSP rc - Run-command processor
d6 1
a6 1
** This file is part of OSSP rc, a portable Run-command processor
d27 1
a27 1
** rc_sect.c: Run-command processor ISO C source file
@
1.17
log
@Replace references to scriptAppend with scriptAdd, and change name of
scriptAppend to scriptnAppend to avoid surprises. Also, debug minimal memory
overallocation in scriptnAppend.
@
text
@d2 3
a4 3
** Copyright (c) 2002 Ralf S. Engelschall
** Copyright (c) 2002 Cable & Wireless Deutschland GmbH
** Copyright (c) 2002 The OSSP Project
@
1.16
log
@Implement common section parsing and running on execution mode.
@
text
@d162 10
d174 4
a177 5
char *szScriptdata = NULL;
if (pSec && (szScriptdata = scriptGetdata(pSec->m_pData)))
if (strlen(szScriptdata) > 0)
return(szScriptdata);
d180 1
@
1.15
log
@Break off before fully implementing common section run ops, but after
reorganization of class data, and additional member functions for section and
script manipulation.
@
text
@d164 7
a170 2
if (pSec && scriptGetdata(pSec->m_pData))
return(scriptGetdata(pSec->m_pData));
@
1.14
log
@Removed analyzer class, removed label class, implemented list class,
implemented file class, cleanup and restructure.
@
text
@d53 1
d70 17
a86 3
pSec = (rc_section_t *)malloc(sizeof(rc_section_t));
pSec->m_nPri = pOrigsec->m_nPri;
pSec->m_nUid = pOrigsec->m_nUid;
d96 4
a99 4
if (pOrigsec->m_szData) {
pSec->m_szData = malloc((strlen(pOrigsec->m_szData) + sizeof(char))\
* sizeof(char));
strcpy(pSec->m_szData, pOrigsec->m_szData);
d142 10
d164 2
a165 2
if (pSec && pSec->m_szData)
return(pSec->m_szData);
d207 11
d229 1
a229 1
rc_return_t sectionSetdata(rc_section_t *pSec, const char *kszScript)
d231 6
a236 12
if (pSec) {
size_t nBytes = (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(nBytes);
strcpy(pSec->m_szData, kszScript);
}
else { /* Set the data the usual way */
pSec->m_szData = malloc(nBytes);
strcpy(pSec->m_szData, kszScript);
}
return(RC_THROW(RC_OK));
d239 2
a240 1
return(RC_THROW(RC_ERR_USE));
d243 1
a243 1
rc_return_t sectionSetndata(rc_section_t *pSec, const char *kszScript, size_t Len)
d245 8
a252 14
if (pSec) {
size_t nBytes = (Len + 1) * sizeof(char); /* Set size */
if (pSec->m_szData) { /* The section data is already in use */
free(pSec->m_szData);
pSec->m_szData = malloc(nBytes);
strncpy(pSec->m_szData, kszScript, Len);
*(pSec->m_szData + Len) = '\0'; /* Terminate outgoing */
}
else { /* Set the data the usual way */
pSec->m_szData = malloc(nBytes);
strncpy(pSec->m_szData, kszScript, Len);
*(pSec->m_szData + Len) = '\0'; /* Terminate outgoing */
}
return(RC_THROW(RC_OK));
d255 8
a262 1
return(RC_THROW(RC_ERR_USE));
d316 5
a320 3
if (pSec->m_szData)
free(pSec->m_szData);
if (pSec->m_szName)
d322 3
a324 1
if (pSec->m_szLogin)
d326 2
@
1.13
log
@Strip off unused section label.
@
text
@a71 1
pSec->m_Bytes = pOrigsec->m_Bytes;
a146 10
size_t sectionGetlen(rc_section_t *pSec)
{ /* Data length of section, length of a script body of a particular section */
if (pSec)
return(pSec->m_Bytes);
else
RC_THROW(RC_ERR_USE);
return(0); /* Not reached */
}
d196 1
a196 1
pSec->m_Bytes = (strlen(kszScript) + sizeof(char)) * sizeof(char);
d199 1
a199 1
pSec->m_szData = malloc(pSec->m_Bytes);
d203 1
a203 1
pSec->m_szData = malloc(pSec->m_Bytes);
d215 1
a215 1
pSec->m_Bytes = (Len + 1) * sizeof(char); /* Set size */
d218 1
a218 1
pSec->m_szData = malloc(pSec->m_Bytes);
d223 1
a223 1
pSec->m_szData = malloc(pSec->m_Bytes);
@
1.12
log
@Implement limited verbosity on eval modus, and begin mergin the label object
and the section object.
@
text
@a127 10
const char *sectionGetlabel(rc_section_t *pSec)
{ /* Rc label, used for display during verbose */
if (pSec)
return(pSec->m_szLabel);
else
RC_THROW(RC_ERR_USE);
return(0); /* Not reached */
}
a186 11
return(RC_THROW(RC_OK));
}
return(RC_THROW(RC_ERR_USE));
}
rc_return_t sectionSetlabel(rc_section_t *pSec, const char *szLabel)
{ /* Rc label, used for display during verbose */
if (pSec) {
pSec->m_szLabel = malloc((strlen(szLabel) + 1) * sizeof (char));
strcpy(pSec->m_szLabel, szLabel);
@
1.11
log
@Clean up non BSD compiler warnings.
@
text
@d118 20
d186 22
@
1.10
log
@Bug fix recent eval mode addition, and add login name parsing to eval mode.
@
text
@d205 1
a205 1
pSec->m_Bytes = Len * sizeof(char) + sizeof(char); /* Set size */
d210 1
a210 1
*(pSec->m_szData + Len) = NULL; /* Terminate outgoing */
d215 1
a215 1
*(pSec->m_szData + Len) = NULL; /* Terminate outgoing */
@
1.9
log
@Implement eval mode.
@
text
@d229 2
d232 2
a233 1
fprintf(stdout, "#su %s\n", sectionGetlogin(pSec));
d248 7
a254 1
FILE *pStream = fdopen(nFdtmp, "w");
d256 1
a256 1
if (pSec && pStream) {
@
1.8
log
@Implement rc label ordered command printing and execution.
@
text
@d32 2
d232 19
@
1.7
log
@Use strlen only on condition of a valid incoming pointer.
@
text
@d37 1
a37 1
* sectionNew(void) *
d40 1
a40 1
rc_section_t *sectionNew(void)
d48 5
a52 1
if (!pSec)
d246 2
@
1.6
log
@Added section login accessors for user name handling during print op,
implemented user id and user name parsing in section and script objects.
@
text
@d69 5
a73 3
pSec->m_szLogin = malloc((strlen(pOrigsec->m_szLogin) + sizeof(char))\
* sizeof(char));
strcpy(pSec->m_szLogin, pOrigsec->m_szLogin);
d76 5
a80 3
pSec->m_szData = malloc((strlen(pOrigsec->m_szData) + sizeof(char))\
* sizeof(char));
strcpy(pSec->m_szData, pOrigsec->m_szData);
@
1.5
log
@Implement priority scheduling with qsort(3) and priCompare(), adhere to naming
standard, and bugfix.
@
text
@d64 12
a75 4
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);
d108 10
d162 11
d176 1
a176 1
pSec->m_Bytes = strlen(kszScript) * sizeof(char) + sizeof(char);
d220 1
d238 2
@
1.4
log
@Add sectionCopy(), sectionDump(), and vectorCount(), and change the processor
object's script vector to a section vector.
@
text
@d64 5
a68 5
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;
d83 1
a83 1
return(pSec->nPri);
d93 1
a93 1
return(pSec->nUid);
d102 2
a103 2
if (pSec && pSec->szData)
return(pSec->szData);
d113 1
a113 1
return(pSec->Bytes);
d127 1
a127 1
pSec->nPri = nPriority;
d137 1
a137 1
pSec->nUid = nUserid;
d147 5
a151 5
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);
d154 2
a155 2
pSec->szData = malloc(pSec->Bytes);
strcpy(pSec->szData, kszScript);
d166 6
a171 6
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 */
d174 3
a176 3
pSec->szData = malloc(pSec->Bytes);
strncpy(pSec->szData, kszScript, Len);
*(pSec->szData + Len) = NULL; /* Terminate outgoing */
a189 2
/* Don't remove this! It encapsulates the script object, */
/* which might not be a simple string */
d206 2
a207 2
if (pSec->szData)
free(pSec->szData);
@
1.3
log
@Correctly use section accessors, split script to common and section vector
objects, add sectionSetndata (with n length sections), and wrap script dump
logic for NULL pointer safety.
@
text
@d55 22
d182 16
@
1.2
log
@Bring rc back to life, corrected the processor and script object memory
problems, and made small changes to test suite.
@
text
@d102 1
a102 1
rc_return_t sectionSetpri(rc_section_t *pSec, int nPriority)
d112 1
a112 1
rc_return_t sectionSetuid(rc_section_t *pSec, int nUserid)
d125 1
a125 1
pSec->Bytes = strlen(kszScript) + sizeof(char); /* Calculate size */
d128 1
a128 1
pSec->szData = malloc(pSec->szData);
d132 1
a132 1
pSec->szData = malloc(pSec->szData);
d134 21
@
1.1
log
@Newly born section class for use in piecing together script fragments.
@
text
@d31 1
d46 4
a49 2
pSec = (rc_section_t *)malloc(sizeof(rc_section_t));
*pSec = NULL;
d88 10
d125 1
d128 1
a128 1
pSec->szData = malloc(strlen(kszScript) + sizeof(char));
d132 1
a132 1
pSec->szData = malloc(strlen(kszScript) + sizeof(char));
@