Created
March 20, 2011 22:40
-
-
Save eqdw/878755 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define MSG_FORMAT "%s cannot be authenticated.\n" | |
void incorrect_password(const char *user) | |
{ | |
// user names are restricted to 256 characters (or less) | |
static const char *msg_format = MSG_FORMAT; | |
size_t len = strlen(user) + sizeof(MSG_FORMAT); | |
char *msg = (char *)malloc(len); | |
if (msg) | |
{ | |
int ret = snprintf(msg, len, msg_format, user); | |
if (ret>=0 && ret<len) | |
fprintf(stderr, msg); | |
free(msg); | |
msg = NULL; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment