Fix some visual flaws in the auth callback of the client.

This commit is contained in:
Andreas Schneider 2008-08-12 11:18:24 +02:00
parent 95f4db7c4f
commit 27800adce5
2 changed files with 7 additions and 5 deletions

View file

@ -75,9 +75,9 @@ int csync_auth(const char *prompt, char *buf, size_t len, int echo, int verify)
/* read the password */ /* read the password */
while (!ok) { while (!ok) {
if (*buf) { if (*buf) {
fprintf(stdout, "%s: [%s] ", prompt, buf); fprintf(stdout, "%s [%s] ", prompt, buf);
} else { } else {
fprintf(stdout, "%s: ", prompt); fprintf(stdout, "%s ", prompt);
} }
fflush(stdout); fflush(stdout);
while (! fgets(tmp, len, stdin)); while (! fgets(tmp, len, stdin));
@ -85,6 +85,7 @@ int csync_auth(const char *prompt, char *buf, size_t len, int echo, int verify)
if ((ptr = strchr(tmp, '\n'))) { if ((ptr = strchr(tmp, '\n'))) {
*ptr = '\0'; *ptr = '\0';
} }
fprintf(stdout, "\n");
if (*tmp) { if (*tmp) {
strncpy(buf, tmp, len); strncpy(buf, tmp, len);
@ -103,6 +104,7 @@ int csync_auth(const char *prompt, char *buf, size_t len, int echo, int verify)
if ((ptr = strchr(key_string, '\n'))) { if ((ptr = strchr(key_string, '\n'))) {
*ptr = '\0'; *ptr = '\0';
} }
fprintf(stdout, "\n");
if (strcmp(buf, key_string)) { if (strcmp(buf, key_string)) {
printf("\n\07\07Mismatch - try again\n"); printf("\n\07\07Mismatch - try again\n");
fflush(stdout); fflush(stdout);

View file

@ -76,8 +76,8 @@ static void get_auth_data_with_context_fn(SMBCCTX *c,
/* Call the passwort prompt */ /* Call the passwort prompt */
if (auth_cb != NULL) { if (auth_cb != NULL) {
DEBUG_SMB(("csync_smb - execute authentication callback\n")); DEBUG_SMB(("csync_smb - execute authentication callback\n"));
(*auth_cb) ("Username", un, unlen, 1, 0); (*auth_cb) ("Username:", un, unlen, 1, 0);
(*auth_cb) ("Password", pw, pwlen, 0, 0); (*auth_cb) ("Password:", pw, pwlen, 0, 0);
} }
DEBUG_SMB(("csync_smb - user=%s, workgroup=%s, server=%s, share=%s\n", DEBUG_SMB(("csync_smb - user=%s, workgroup=%s, server=%s, share=%s\n",