On 01/22/2010 03:08 PM, Lee Verberne wrote:
# grep systemIdPath /etc/sysconfig/rhn/up2date systemIdPath[comment]=Location of system id systemIdPath=/etc/sysconfig/rhn/systemidI went ahead and did an ltrace of my rhnsd. Notice the regcomp() but no regexec(): memset(0x7fff730f08a0, '\000', 512) = 0x7fff730f08a0 access("/etc/sysconfig/rhn/up2date", 4) = 0 regcomp(0x7fff730f0430, 0x402638, 1, 0x402400, 0) = 0 fopen("/etc/sysconfig/rhn/up2date", "r") = 0xef22070 fgets("", 1930364064, 0xef22150) = 0x7fff730f04a0 __strncpy_chk(0x7fff730f08a0, 0x7fffe61e0940, 0, 512, 0x6e6f637379732f63) = 0x7fff730f08a0 access("", 4) = -1
Ahh, I see. See if this patch fixes it. Thanks, Josh
diff --git a/client/rhel/rhnsd/rhnsd.c b/client/rhel/rhnsd/rhnsd.c
index c2d0583..b6484d7 100644
--- a/client/rhel/rhnsd/rhnsd.c
+++ b/client/rhel/rhnsd/rhnsd.c
@@ -585,6 +585,7 @@ static void SIGHUP_handler(int signum)
/* parse systemIdPath from the up2date configuration file */
static int parse_systemid_path(char* systemid_path, int systemid_path_length)
{
+ int ret = 1; /* 1 indicates file not found */
FILE* config_file;
regex_t re_systemIdPath;
regmatch_t submatch[SYSTEMID_NMATCH];
@@ -595,16 +596,20 @@ static int parse_systemid_path(char* systemid_path, int
systemid_path_length)
char line[MAX_CONFIG_LINE_SIZE];
while (NULL != fgets(line, MAX_CONFIG_LINE_SIZE, config_file))
{
- int match_length = submatch[1].rm_eo - submatch[1].rm_so;
- if (systemid_path_length < match_length)
- match_length = systemid_path_length - 1;
-
- strncpy(systemid_path, &line[submatch[1].rm_so], match_length);
- systemid_path[match_length] = '\0';
- return 0;
+ if (regexec(&re_systemIdPath, line, SYSTEMID_NMATCH, submatch, 0)
!= REG_NOMATCH)
+ {
+ int match_length = submatch[1].rm_eo - submatch[1].rm_so;
+ if (systemid_path_length < match_length)
+ match_length = systemid_path_length - 1;
+
+ strncpy(systemid_path, &line[submatch[1].rm_so], match_length);
+ systemid_path[match_length] = '\0';
+ ret = 0;
+ break;
+ }
}
fclose(config_file);
}
- return 1; /* file / key not found */
+ return ret;
}
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ Spacewalk-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/spacewalk-list
