[dovecot-cvs] dovecot/src/lib-auth auth-client.h, 1.9, 1.10 auth-server-request.c, 1.22, 1.23

cras at dovecot.org cras at dovecot.org
Sat Oct 1 13:52:18 EEST 2005


Update of /var/lib/cvs/dovecot/src/lib-auth
In directory talvi:/tmp/cvs-serv23762/src/lib-auth

Modified Files:
	auth-client.h auth-server-request.c 
Log Message:
Added ssl_username_from_cert setting. Not actually tested yet..



Index: auth-client.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-auth/auth-client.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- auth-client.h	19 Oct 2004 02:51:37 -0000	1.9
+++ auth-client.h	1 Oct 2005 10:52:15 -0000	1.10
@@ -25,6 +25,7 @@
 struct auth_request_info {
 	const char *mech;
 	const char *service;
+	const char *cert_username;
 	enum auth_request_flags flags;
 
 	struct ip_addr local_ip, remote_ip;

Index: auth-server-request.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-auth/auth-server-request.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- auth-server-request.c	7 Jan 2005 17:34:07 -0000	1.22
+++ auth-server-request.c	1 Oct 2005 10:52:15 -0000	1.23
@@ -15,7 +15,7 @@
 
 	unsigned int id;
 
-	char *mech, *service;
+	char *mech, *service, *cert_username;
         enum auth_request_flags flags;
 	struct ip_addr local_ip, remote_ip;
 
@@ -67,6 +67,19 @@
 	}
 }
 
+static int is_valid_string(const char *str)
+{
+	const char *p;
+
+	/* make sure we're not sending any characters that have a special
+	   meaning. */
+	for (p = str; *p != '\0'; p++) {
+		if (*p == '\t' || *p == '\n' || *p == '\r')
+			return FALSE;
+	}
+	return TRUE;
+}
+
 static int auth_server_send_new_request(struct auth_server_connection *conn,
 					struct auth_request *request)
 {
@@ -83,6 +96,13 @@
 	if ((request->flags & AUTH_REQUEST_FLAG_VALID_CLIENT_CERT) != 0)
 		str_append(str, "\tvalid-client-cert");
 
+	if (request->cert_username != NULL) {
+		if (!is_valid_string(request->cert_username)) {
+			t_pop();
+			return FALSE;
+		}
+		str_printfa(str, "\tcert_username=%s", request->cert_username);
+	}
 	if (request->local_ip.family != 0)
 		str_printfa(str, "\tlip=%s", net_ip2addr(&request->local_ip));
 	if (request->remote_ip.family != 0)
@@ -309,6 +329,7 @@
 	request->conn = conn;
 	request->mech = i_strdup(request_info->mech);
 	request->service = i_strdup(request_info->service);
+	request->cert_username = i_strdup(request_info->cert_username);
 	request->flags = request_info->flags;
 	request->local_ip = request_info->local_ip;
 	request->remote_ip = request_info->remote_ip;
@@ -346,6 +367,7 @@
 	i_free(request->plaintext_data);
 	i_free(request->mech);
 	i_free(request->service);
+	i_free(request->cert_username);
 	i_free(request);
 }
 



More information about the dovecot-cvs mailing list