fixed sense of validateSid() to work with cli infrastructure.

(mdp ping with a SID works again now)
This commit is contained in:
gardners 2012-04-30 07:01:21 +09:30
parent 8a7d3e44f3
commit f174912124

View File

@ -107,19 +107,19 @@ int validateSid(const char *sid)
{ {
size_t n = strlen(sid); size_t n = strlen(sid);
if (n != SID_STRLEN) if (n != SID_STRLEN)
return WHYF("Invalid SID (strlen is %u, should be %u)", n, SID_STRLEN); { WHYF("Invalid SID (strlen is %u, should be %u)", n, SID_STRLEN); return 0; }
const char *s; const char *s;
for (s = sid; *s; ++s) for (s = sid; *s; ++s)
if (hexvalue(*s) == -1) if (hexvalue(*s) == -1)
return WHY("SID contains non-hex character"); { WHY("SID contains non-hex character"); return 0; }
return 0; return 1;
} }
int stowSid(unsigned char *packet, int ofs, const char *sid) int stowSid(unsigned char *packet, int ofs, const char *sid)
{ {
if (debug&DEBUG_PACKETFORMATS) if (debug&DEBUG_PACKETFORMATS)
printf("Stowing SID \"%s\"\n", sid); printf("Stowing SID \"%s\"\n", sid);
if (validateSid(sid)) if (!validateSid(sid))
return WHY("Invalid SID passed in"); return WHY("Invalid SID passed in");
int i; int i;
for(i = 0; i != SID_SIZE; ++i) { for(i = 0; i != SID_SIZE; ++i) {