* returns a pointer to the next token or NULL if the current * token doesn't match */
| 7201 | * token doesn't match |
| 7202 | */ |
| 7203 | static char * |
| 7204 | pwdfMatchesString(char *buf, const char *token) |
| 7205 | { |
| 7206 | char *tbuf; |
| 7207 | const char *ttok; |
| 7208 | bool bslash = false; |
| 7209 | |
| 7210 | if (buf == NULL || token == NULL) |
| 7211 | return NULL; |
| 7212 | tbuf = buf; |
| 7213 | ttok = token; |
| 7214 | if (tbuf[0] == '*' && tbuf[1] == ':') |
| 7215 | return tbuf + 2; |
| 7216 | while (*tbuf != 0) |
| 7217 | { |
| 7218 | if (*tbuf == '\\' && !bslash) |
| 7219 | { |
| 7220 | tbuf++; |
| 7221 | bslash = true; |
| 7222 | } |
| 7223 | if (*tbuf == ':' && *ttok == 0 && !bslash) |
| 7224 | return tbuf + 1; |
| 7225 | bslash = false; |
| 7226 | if (*ttok == 0) |
| 7227 | return NULL; |
| 7228 | if (*tbuf == *ttok) |
| 7229 | { |
| 7230 | tbuf++; |
| 7231 | ttok++; |
| 7232 | } |
| 7233 | else |
| 7234 | return NULL; |
| 7235 | } |
| 7236 | return NULL; |
| 7237 | } |
| 7238 | |
| 7239 | /* Get a password from the password file. Return value is malloc'd. */ |
| 7240 | static char * |