diff --git a/src/session.c b/src/session.c
index acf4a581c1c6bb6d58af4b4f650e2c9ce7ad2566..ca5b89be3c34961eb90d76fb8dbd4b663b13dd93 100644 (file)
--- a/src/session.c
+++ b/src/session.c
-/* $Id$ */
-
/***
Copyright (c) 2004-2006 Lennart Poettering
}
}
}
-
+
fprintf(stderr, "%s: ", p);
r = fgets(q, sizeof(q), stdin);
l = strlen(q);
tcsetattr(fileno(stdin), TCSANOW, &t);
fprintf(stderr, "\n");
}
-
+
return r ? strdup(r) : NULL;
}
@@ -102,7 +100,7 @@ static int ssl_verify_cb(__unused void *userdata, __unused int failures, __unuse
static int ne_auth_creds_cb(__unused void *userdata, const char *realm, int attempt, char *u, char *p) {
int r = -1;
-
+
pthread_mutex_lock(&credential_mutex);
if (attempt) {
@@ -114,10 +112,10 @@ static int ne_auth_creds_cb(__unused void *userdata, const char *realm, int atte
if (!username || !password)
fprintf(stderr, "Realm '%s' requires authentication.\n", realm);
-
+
if (!username)
username = ask_user("Username", 0);
-
+
if (username && !password)
password = ask_user("Password", 1);
return NULL;
scheme = uri.scheme ? uri.scheme : "http";
-
+
if (!(session = ne_session_create(scheme, uri.host, uri.port ? uri.port : ne_uri_defaultport(scheme)))) {
fprintf(stderr, "Failed to create session\n");
return NULL;
if (with_lock && lock_store)
ne_lockstore_register(lock_store, session);
-
+
return session;
}
ne_session *session_get(int with_lock) {
ne_session *session;
-
+
pthread_once(&session_once, session_tsd_key_init);
if ((session = pthread_getspecific(session_tsd_key)))
int session_set_uri(const char *s, const char *u, const char *p) {
int l;
-
+
assert(!b_uri);
assert(!username);
assert(!password);
password = strdup(p);
return 0;
-
+
finish:
-
+
if (b_uri) {
ne_uri_free(&uri);
b_uri = 0;
strcmp(u->host, uri.host) == 0 &&
u->port == uri.port;
}
-