changeset 2781:e44a84dc947c HEAD

s/protocol/service/ in authentication
author Timo Sirainen <tss@iki.fi>
date Tue, 19 Oct 2004 05:51:37 +0300
parents 4ff5b3e8ee51
children 31154fd63ca8
files src/auth/auth-client-connection.c src/auth/auth-client-connection.h src/auth/mech-rpa.c src/auth/mech.c src/auth/mech.h src/auth/passdb-pam.c src/auth/passdb-vpopmail.c src/lib-auth/auth-client.h src/lib-auth/auth-server-request.c src/login-common/sasl-server.c src/login-common/sasl-server.h
diffstat 11 files changed, 30 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/auth-client-connection.c	Tue Oct 19 04:47:55 2004 +0300
+++ b/src/auth/auth-client-connection.c	Tue Oct 19 05:51:37 2004 +0300
@@ -123,10 +123,10 @@
 }
 
 static int
-auth_client_input_proto(struct auth_client_connection *conn, const char *args)
+auth_client_input_service(struct auth_client_connection *conn, const char *args)
 {
-	if (conn->default_protocol == NULL)
-		conn->default_protocol = p_strdup(conn->pool, args);
+	if (conn->default_service == NULL)
+		conn->default_service = p_strdup(conn->pool, args);
 	return TRUE;
 }
 
@@ -228,19 +228,19 @@
 			(void)net_addr2ip(arg, &request->local_ip);
 		else if (strcmp(name, "rip") == 0)
 			(void)net_addr2ip(arg, &request->remote_ip);
-		else if (strcmp(name, "proto") == 0)
-			request->protocol = p_strdup(request->pool, arg);
+		else if (strcmp(name, "service") == 0)
+			request->service = p_strdup(request->pool, arg);
 		else if (strcmp(name, "resp") == 0)
 			initial_resp = arg;
 		else if (strcmp(name, "valid-client-cert") == 0)
 			valid_client_cert = TRUE;
 	}
 
-	if (request->protocol == NULL)
-		request->protocol = conn->default_protocol;
-	if (request->protocol == NULL) {
+	if (request->service == NULL)
+		request->service = conn->default_service;
+	if (request->service == NULL) {
 		i_error("BUG: Authentication client %u "
-			"didn't specify protocol in request", conn->pid);
+			"didn't specify service in request", conn->pid);
 		auth_request_destroy(request);
 		return FALSE;
 	}
@@ -390,8 +390,8 @@
 			ret = auth_client_input_cont(conn, line + 5);
 		else if (strncmp(line, "CPID\t", 5) == 0)
 			ret = auth_client_input_cpid(conn, line + 5);
-		else if (strncmp(line, "PROTO\t", 6) == 0)
-			ret = auth_client_input_proto(conn, line + 6);
+		else if (strncmp(line, "SERVICE\t", 6) == 0)
+			ret = auth_client_input_service(conn, line + 6);
 		else {
 			/* ignore unknown command */
 			ret = TRUE;
--- a/src/auth/auth-client-connection.h	Tue Oct 19 04:47:55 2004 +0300
+++ b/src/auth/auth-client-connection.h	Tue Oct 19 05:51:37 2004 +0300
@@ -14,7 +14,7 @@
 
 	pool_t pool;
 	struct hash_table *auth_requests;
-	char *default_protocol;
+	char *default_service;
 
 	unsigned int pid;
 	unsigned int connect_uid;
--- a/src/auth/mech-rpa.c	Tue Oct 19 04:47:55 2004 +0300
+++ b/src/auth/mech-rpa.c	Tue Oct 19 05:51:37 2004 +0300
@@ -450,7 +450,7 @@
 		return;
 	}
 
-	service = t_str_lcase(auth_request->protocol);
+	service = t_str_lcase(auth_request->service);
 
 	token2 = mech_rpa_build_token2(request, t_strconcat(service, "@",
 				       my_hostname, NULL), &token2_size);
--- a/src/auth/mech.c	Tue Oct 19 04:47:55 2004 +0300
+++ b/src/auth/mech.c	Tue Oct 19 05:51:37 2004 +0300
@@ -220,7 +220,7 @@
 	tab[2].value = strchr(auth_request->user, '@');
 	if (tab[2].value != NULL)
 		tab[2].value = escape_func(tab[2].value+1);
-	tab[3].value = auth_request->protocol;
+	tab[3].value = auth_request->service;
 	/* tab[4] = we have no home dir */
 	if (auth_request->local_ip.family != 0)
 		tab[5].value = net_ip2addr(&auth_request->local_ip);
--- a/src/auth/mech.h	Tue Oct 19 04:47:55 2004 +0300
+++ b/src/auth/mech.h	Tue Oct 19 05:51:37 2004 +0300
@@ -30,7 +30,7 @@
 	unsigned int id;
 	time_t created;
 
-	const char *protocol;
+	const char *service;
 	struct ip_addr local_ip, remote_ip;
 	mech_callback_t *callback;
 
--- a/src/auth/passdb-pam.c	Tue Oct 19 04:47:55 2004 +0300
+++ b/src/auth/passdb-pam.c	Tue Oct 19 05:51:37 2004 +0300
@@ -349,7 +349,7 @@
 	int fd[2];
 	pid_t pid;
 
-	service = service_name != NULL ? service_name : request->protocol;
+	service = service_name != NULL ? service_name : request->service;
 	if (pipe(fd) < 0) {
 		i_error("pam(%s): pipe() failed: %m", get_log_prefix(request));
 		callback(PASSDB_RESULT_INTERNAL_FAILURE, request);
--- a/src/auth/passdb-vpopmail.c	Tue Oct 19 04:47:55 2004 +0300
+++ b/src/auth/passdb-vpopmail.c	Tue Oct 19 05:51:37 2004 +0300
@@ -34,12 +34,12 @@
 	}
 
 	if (((vpw->pw_gid & NO_IMAP) != 0 &&
-	     strcmp(request->protocol, "IMAP") == 0) ||
+	     strcmp(request->service, "IMAP") == 0) ||
 	    ((vpw->pw_gid & NO_POP) != 0 &&
-	     strcmp(request->protocol, "POP3") == 0)) {
+	     strcmp(request->service, "POP3") == 0)) {
 		if (verbose) {
 			i_info("vpopmail(%s): %s disabled",
-			       get_log_prefix(request), request->protocol);
+			       get_log_prefix(request), request->service);
 		}
 		callback(PASSDB_RESULT_USER_DISABLED, request);
 		return;
@@ -70,8 +70,8 @@
 	}
 
 #ifdef HAVE_VPOPMAIL_OPEN_SMTP_RELAY
-	if (strcmp(request->protocol, "POP3") == 0 ||
-	    strcmp(request->protocol, "IMAP") == 0) {
+	if (strcmp(request->service, "POP3") == 0 ||
+	    strcmp(request->service, "IMAP") == 0) {
 		const char *host = net_ip2addr(&request->remote_ip);
 		if (host != NULL) {
 			/* use putenv() directly rather than env_put() which
--- a/src/lib-auth/auth-client.h	Tue Oct 19 04:47:55 2004 +0300
+++ b/src/lib-auth/auth-client.h	Tue Oct 19 05:51:37 2004 +0300
@@ -24,7 +24,7 @@
 
 struct auth_request_info {
 	const char *mech;
-	const char *protocol;
+	const char *service;
 	enum auth_request_flags flags;
 
 	struct ip_addr local_ip, remote_ip;
--- a/src/lib-auth/auth-server-request.c	Tue Oct 19 04:47:55 2004 +0300
+++ b/src/lib-auth/auth-server-request.c	Tue Oct 19 05:51:37 2004 +0300
@@ -15,7 +15,7 @@
 
 	unsigned int id;
 
-	char *mech, *protocol;
+	char *mech, *service;
         enum auth_request_flags flags;
 	struct ip_addr local_ip, remote_ip;
 
@@ -76,8 +76,8 @@
 	t_push();
 	str = t_str_new(512);
 
-	str_printfa(str, "AUTH\t%u\t%s\tproto=%s",
-		    request->id, request->mech, request->protocol);
+	str_printfa(str, "AUTH\t%u\t%s\tservice=%s",
+		    request->id, request->mech, request->service);
 	if ((request->flags & AUTH_REQUEST_FLAG_SECURED) != 0)
 		str_append(str, "\tsecured");
 	if ((request->flags & AUTH_REQUEST_FLAG_VALID_CLIENT_CERT) != 0)
@@ -305,7 +305,7 @@
 	request = i_new(struct auth_request, 1);
 	request->conn = conn;
 	request->mech = i_strdup(request_info->mech);
-	request->protocol = i_strdup(request_info->protocol);
+	request->service = i_strdup(request_info->service);
 	request->flags = request_info->flags;
 	request->local_ip = request_info->local_ip;
 	request->remote_ip = request_info->remote_ip;
@@ -342,7 +342,7 @@
 	i_free(request->initial_resp_base64);
 	i_free(request->plaintext_data);
 	i_free(request->mech);
-	i_free(request->protocol);
+	i_free(request->service);
 	i_free(request);
 }
 
--- a/src/login-common/sasl-server.c	Tue Oct 19 04:47:55 2004 +0300
+++ b/src/login-common/sasl-server.c	Tue Oct 19 05:51:37 2004 +0300
@@ -107,7 +107,7 @@
 }
 
 void sasl_server_auth_begin(struct client *client,
-			    const char *protocol, const char *mech_name,
+			    const char *service, const char *mech_name,
 			    const char *initial_resp_base64,
 			    sasl_server_callback_t *callback)
 {
@@ -136,7 +136,7 @@
 
 	memset(&info, 0, sizeof(info));
 	info.mech = mech->name;
-	info.protocol = protocol;
+	info.service = service;
 	info.flags = client_get_auth_flags(client);
 	info.local_ip = client->local_ip;
 	info.remote_ip = client->ip;
--- a/src/login-common/sasl-server.h	Tue Oct 19 04:47:55 2004 +0300
+++ b/src/login-common/sasl-server.h	Tue Oct 19 05:51:37 2004 +0300
@@ -13,7 +13,7 @@
 				    const char *data, const char *const *args);
 
 void sasl_server_auth_begin(struct client *client,
-			    const char *protocol, const char *mech_name,
+			    const char *service, const char *mech_name,
 			    const char *initial_resp_base64,
 			    sasl_server_callback_t *callback);
 void sasl_server_auth_cancel(struct client *client, const char *reason);