fec479ae4c
problem but is not used anywhere and will probably be removed from cfengine from maintainer William Yodlowsky <bsd at openbsd.rutgers.edu>
139 lines
4.0 KiB
Plaintext
139 lines
4.0 KiB
Plaintext
$OpenBSD: patch-src_cfagent_c,v 1.5 2005/10/27 21:47:28 sturm Exp $
|
|
--- src/cfagent.c.orig Wed Sep 21 16:06:14 2005
|
|
+++ src/cfagent.c Fri Oct 21 16:35:54 2005
|
|
@@ -205,7 +205,7 @@ void Initialize(int argc,char *argv[])
|
|
unsigned char s[16];
|
|
char ebuff[CF_EXPANDSIZE];
|
|
|
|
-strcpy(VDOMAIN,CF_START_DOMAIN);
|
|
+(void)strlcpy(VDOMAIN,CF_START_DOMAIN,sizeof(VDOMAIN));
|
|
|
|
PreLockState();
|
|
|
|
@@ -218,7 +218,7 @@ VMAILSERVER[0] = '\0';
|
|
ALLCLASSBUFFER[0] = '\0';
|
|
VREPOSITORY = strdup("\0");
|
|
|
|
-strcpy(METHODNAME,"cf-nomethod");
|
|
+(void)strlcpy(METHODNAME,"cf-nomethod",sizeof(METHODNAME));
|
|
METHODREPLYTO[0] = '\0';
|
|
METHODFOR[0] = '\0';
|
|
|
|
@@ -226,8 +226,8 @@ METHODFOR[0] = '\0';
|
|
re_syntax_options |= RE_INTERVALS;
|
|
#endif
|
|
|
|
-strcpy(VINPUTFILE,"cfagent.conf");
|
|
-strcpy(VNFSTYPE,"nfs");
|
|
+(void)strlcpy(VINPUTFILE,"cfagent.conf",CF_BUFSIZE);
|
|
+(void)strlcpy(VNFSTYPE,"nfs",sizeof(VNFSTYPE));
|
|
|
|
IDClasses();
|
|
|
|
@@ -270,27 +270,28 @@ for (i = 1; i < argc; i++)
|
|
|
|
/* XXX Initialize workdir for non privileged users */
|
|
|
|
- strcpy(CFWORKDIR,WORKDIR);
|
|
+ (void)strlcpy(CFWORKDIR,WORKDIR,sizeof(CFWORKDIR));
|
|
|
|
if (getuid() > 0)
|
|
{
|
|
char *homedir;
|
|
if ((homedir = getenv("HOME")) != NULL)
|
|
{
|
|
- strcpy(CFWORKDIR,homedir);
|
|
- strcat(CFWORKDIR,"/.cfagent");
|
|
+ (void)strlcpy(CFWORKDIR,homedir,sizeof(CFWORKDIR));
|
|
+ (void)strlcat(CFWORKDIR,"/.cfagent",sizeof(CFWORKDIR));
|
|
}
|
|
}
|
|
|
|
- sprintf(ebuff,"%s/state/cf_procs",CFWORKDIR);
|
|
+ (void)snprintf(ebuff,sizeof(ebuff),"%s/state/cf_procs",CFWORKDIR);
|
|
|
|
if (stat(ebuff,&statbuf) == -1)
|
|
{
|
|
CreateEmptyFile(ebuff);
|
|
}
|
|
|
|
- strcpy(VLOGDIR,CFWORKDIR);
|
|
- strcpy(VLOCKDIR,VLOGDIR); /* Same since 2.0.a8 */
|
|
+ (void)strlcpy(VLOGDIR,CFWORKDIR,CF_BUFSIZE);
|
|
+ (void)strlcpy(VLOCKDIR,VLOGDIR,CF_BUFSIZE); /* Same since 2.0.a8 */
|
|
+
|
|
|
|
OpenSSL_add_all_algorithms();
|
|
ERR_load_crypto_strings();
|
|
@@ -323,8 +324,8 @@ if (NOPRECONFIG)
|
|
return;
|
|
}
|
|
|
|
-strcpy(VPREFIX,"cfengine:");
|
|
-strcat(VPREFIX,VUQNAME);
|
|
+(void)strlcpy(VPREFIX,"cfengine:",40);
|
|
+(void)strlcat(VPREFIX,VUQNAME, 40);
|
|
|
|
if ((sp=getenv(CF_INPUTSVAR)) != NULL)
|
|
{
|
|
@@ -617,8 +618,8 @@ if (strlen(ebuff) != 0)
|
|
}
|
|
else
|
|
{
|
|
- strcpy(VPREFIX,"cfengine:");
|
|
- strcat(VPREFIX,VUQNAME);
|
|
+ (void)strlcpy(VPREFIX,"cfengine:",40);
|
|
+ (void)strlcat(VPREFIX,VUQNAME,40);
|
|
}
|
|
|
|
p2 = SortItemListNames(VHEAP);
|
|
@@ -765,7 +766,7 @@ if (VACTIONSEQ == NULL)
|
|
Warning("perhaps cfagent.conf/update.conf have not yet been set up?");
|
|
}
|
|
|
|
-sprintf(id,"%d",geteuid()); /* get effective user id */
|
|
+(void)snprintf(id,sizeof(id),"%d",geteuid()); /* get effective user id */
|
|
|
|
if (VACCESSLIST != NULL && !IsItemIn(VACCESSLIST,id))
|
|
{
|
|
@@ -920,7 +921,7 @@ if (OptionIs(CONTEXTID,"DryRun",true))
|
|
|
|
if (GetMacroValue(CONTEXTID,"BinaryPaddingChar"))
|
|
{
|
|
- strcpy(ebuff,GetMacroValue(CONTEXTID,"BinaryPaddingChar"));
|
|
+ (void)strlcpy(ebuff,GetMacroValue(CONTEXTID,"BinaryPaddingChar"),sizeof(ebuff));
|
|
|
|
if (ebuff[0] == '\\')
|
|
{
|
|
@@ -1520,7 +1521,7 @@ while (*sp != '\0')
|
|
{
|
|
VIFELAPSED = VDEFAULTIFELAPSED;
|
|
VEXPIREAFTER = VDEFAULTEXPIREAFTER;
|
|
- strcpy(actiontxt,cbuff);
|
|
+ (void)strlcpy(actiontxt,cbuff,sizeof(actiontxt));
|
|
continue;
|
|
}
|
|
else
|
|
@@ -1861,8 +1862,8 @@ for (ip = VHEAP; ip != NULL; ip=ip->next
|
|
else
|
|
{
|
|
size++; /* Allow for : separator */
|
|
- strcat(ALLCLASSBUFFER,ip->name);
|
|
- strcat(ALLCLASSBUFFER,":");
|
|
+ (void)strlcat(ALLCLASSBUFFER,ip->name,sizeof(ALLCLASSBUFFER));
|
|
+ (void)strlcat(ALLCLASSBUFFER,":",sizeof(ALLCLASSBUFFER));
|
|
}
|
|
|
|
fprintf(fp,"%s\n",ip->name);
|
|
@@ -1881,8 +1882,8 @@ for (ip = VHEAP; ip != NULL; ip=ip->next
|
|
else
|
|
{
|
|
size++; /* Allow for : separator */
|
|
- strcat(ALLCLASSBUFFER,ip->name);
|
|
- strcat(ALLCLASSBUFFER,":");
|
|
+ (void)strlcat(ALLCLASSBUFFER,ip->name,sizeof(ALLCLASSBUFFER));
|
|
+ (void)strlcat(ALLCLASSBUFFER,":",sizeof(ALLCLASSBUFFER));
|
|
}
|
|
|
|
fprintf(fp,"%s\n",ip->name);
|