Hi Matthieu, I'd be inclined to go with a return in the middle and avoid some extra variables, what do you think about the following (entirely eye-ball tested)?
char *pass;
/* buffer can be in the form style:pass */
if ((pass = strchr(buffer, ':')) != NULL) {
*pass++ = '\0';
if (priv_pw_check(user, buffer, pass))
return 1; /* or whatever success indicator */
*--pass = ':';
}
return priv_pw_check(user, buffer, NULL);
Thanks
Greg
