httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <...@raleigh.ibm.com>
Subject Moving user and auth_type to request_rec
Date Tue, 23 Mar 1999 18:28:51 GMT

I am including a patch to move the user and auth_type fields to the
request_rec in the apache-apr repository.

Any comments?

Ryan

? config.status
? Makefile
? src/main/.http_core.c.swp
Index: src/include/httpd.h
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/include/httpd.h,v
retrieving revision 1.12
diff -u -r1.12 httpd.h
--- httpd.h	1999/03/17 17:01:10	1.12
+++ httpd.h	1999/03/23 16:43:53
@@ -762,6 +762,11 @@
     array_header *content_languages;	/* array of (char*) */
 
     char *vlist_validator;      /* variant list validator (if negotiated) */
+    
+    char *user;			/* If an authentication check was made,
+				 * this gets set to the user name.
+				 */
+    char *ap_auth_type;		/* Ditto. */
 
     int no_cache;
     int no_local_copy;
@@ -831,11 +836,6 @@
     char *remote_logname;	/* Only ever set if doing rfc1413 lookups.
 				 * N.B. Only access this through
 				 * get_remote_logname() */
-    char *user;			/* If an authentication check was made,
-				 * this gets set to the user name.  We assume
-				 * that there's only one user per connection(!)
-				 */
-    char *ap_auth_type;		/* Ditto. */
 
     unsigned aborted:1;		/* Are we still talking? */
     signed int keepalive:2;	/* Are we using HTTP Keep-Alive?
Index: src/main/http_protocol.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/main/http_protocol.c,v
retrieving revision 1.14
diff -u -r1.14 http_protocol.c
--- http_protocol.c	1999/03/21 10:51:44	1.14
+++ http_protocol.c	1999/03/23 16:44:15
@@ -934,8 +934,8 @@
     conn->keptalive    = conn->keepalive == 1;
     conn->keepalive    = 0;
 
-    conn->user         = NULL;
-    conn->ap_auth_type    = NULL;
+    r->user            = NULL;
+    r->ap_auth_type    = NULL;
 
     r->headers_in      = ap_make_table(r->pool, 50);
     r->subprocess_env  = ap_make_table(r->pool, 50);
@@ -1167,8 +1167,8 @@
      * because it has the lifetime of the connection.  The other allocations
      * are temporary and can be tossed away any time.
      */
-    r->connection->user = ap_getword_nulls (r->connection->pool, &t, ':');
-    r->connection->ap_auth_type = "Basic";
+    r->user = ap_getword_nulls (r->connection->pool, &t, ':');
+    r->ap_auth_type = "Basic";
 
     *pw = t;
 
Index: src/main/util_script.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/main/util_script.c,v
retrieving revision 1.4
diff -u -r1.4 util_script.c
--- util_script.c	1999/03/17 17:01:25	1.4
+++ util_script.c	1999/03/23 16:44:21
@@ -279,11 +279,11 @@
     ap_table_addn(e, "REMOTE_PORT",
 		  ap_psprintf(r->pool, "%d", ntohs(c->remote_addr.sin_port)));
 
-    if (c->user) {
-	ap_table_addn(e, "REMOTE_USER", c->user);
+    if (r->user) {
+	ap_table_addn(e, "REMOTE_USER", r->user);
     }
-    if (c->ap_auth_type) {
-	ap_table_addn(e, "AUTH_TYPE", c->ap_auth_type);
+    if (r->ap_auth_type) {
+	ap_table_addn(e, "AUTH_TYPE", r->ap_auth_type);
     }
     rem_logname = ap_get_remote_logname(r);
     if (rem_logname) {
Index: src/modules/proxy/proxy_ftp.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/modules/proxy/proxy_ftp.c,v
retrieving revision 1.5
diff -u -r1.5 proxy_ftp.c
--- proxy_ftp.c	1999/03/22 20:43:39	1.5
+++ proxy_ftp.c	1999/03/23 16:44:28
@@ -508,8 +508,8 @@
 	 * are temporary and can be tossed away any time.
 	 */
 	user = ap_getword_nulls (r->connection->pool, &password, ':');
-	r->connection->ap_auth_type = "Basic";
-	r->connection->user = r->parsed_uri.user = user;
+	r->ap_auth_type = "Basic";
+	r->user = r->parsed_uri.user = user;
 	nocache = 1;	/* This resource only accessible with username/password */
     }
     else if ((user = r->parsed_uri.user) != NULL) {
Index: src/modules/standard/mod_auth.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_auth.c,v
retrieving revision 1.2
diff -u -r1.2 mod_auth.c
--- mod_auth.c	1999/02/07 06:29:51	1.2
+++ mod_auth.c	1999/03/23 16:44:31
@@ -210,11 +210,11 @@
     if (!sec->auth_pwfile)
 	return DECLINED;
 
-    if (!(real_pw = get_pw(r, c->user, sec->auth_pwfile))) {
+    if (!(real_pw = get_pw(r, r->user, sec->auth_pwfile))) {
 	if (!(sec->auth_authoritative))
 	    return DECLINED;
 	ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
-		    "user %s not found: %s", c->user, r->uri);
+		    "user %s not found: %s", r->user, r->uri);
 	ap_note_basic_auth_failure(r);
 	return AUTH_REQUIRED;
     }
@@ -222,7 +222,7 @@
     if (invalid_pw != NULL) {
 	ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
 		      "user %s: authentication failure for \"%s\": %s",
-		      c->user, r->uri, invalid_pw);
+		      r->user, r->uri, invalid_pw);
 	ap_note_basic_auth_failure(r);
 	return AUTH_REQUIRED;
     }
@@ -235,7 +235,7 @@
 {
     auth_config_rec *sec =
     (auth_config_rec *) ap_get_module_config(r->per_dir_config, &auth_module);
-    char *user = r->connection->user;
+    char *user = r->user;
     int m = r->method_number;
     int method_restricted = 0;
     register int x;
Index: src/modules/standard/mod_auth_anon.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_auth_anon.c,v
retrieving revision 1.2
diff -u -r1.2 mod_auth_anon.c
--- mod_auth_anon.c	1999/02/07 06:29:51	1.2
+++ mod_auth_anon.c	1999/03/23 16:44:31
@@ -230,14 +230,14 @@
     /* Do we allow an empty userID and/or is it the magic one
      */
 
-    if ((!(c->user[0])) && (sec->auth_anon_nouserid)) {
+    if ((!(r->user[0])) && (sec->auth_anon_nouserid)) {
 	res = OK;
     }
     else {
 	auth_anon *p = sec->auth_anon_passwords;
 	res = DECLINED;
 	while ((res == DECLINED) && (p != NULL)) {
-	    if (!(strcasecmp(c->user, p->password)))
+	    if (!(strcasecmp(r->user, p->password)))
 		res = OK;
 	    p = p->next;
 	}
Index: src/modules/standard/mod_auth_db.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_auth_db.c,v
retrieving revision 1.2
diff -u -r1.2 mod_auth_db.c
--- mod_auth_db.c	1999/02/07 06:29:51	1.2
+++ mod_auth_db.c	1999/03/23 16:44:32
@@ -236,11 +236,11 @@
     if (!sec->auth_dbpwfile)
 	return DECLINED;
 
-    if (!(real_pw = get_db_pw(r, c->user, sec->auth_dbpwfile))) {
+    if (!(real_pw = get_db_pw(r, r->user, sec->auth_dbpwfile))) {
 	if (!(sec->auth_dbauthoritative))
 	    return DECLINED;
 	ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
-		    "DB user %s not found: %s", c->user, r->filename);
+		    "DB user %s not found: %s", r->user, r->filename);
 	ap_note_basic_auth_failure(r);
 	return AUTH_REQUIRED;
     }
@@ -253,7 +253,7 @@
     if (invalid_pw != NULL) {
 	ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
 		      "DB user %s: authentication failure for \"%s\": %s",
-		      c->user, r->uri, invalid_pw);
+		      r->user, r->uri, invalid_pw);
 	ap_note_basic_auth_failure(r);
 	return AUTH_REQUIRED;
     }
@@ -267,7 +267,7 @@
     db_auth_config_rec *sec =
     (db_auth_config_rec *) ap_get_module_config(r->per_dir_config,
 					     &db_auth_module);
-    char *user = r->connection->user;
+    char *user = r->user;
     int m = r->method_number;
 
     const array_header *reqs_arr = ap_requires(r);
Index: src/modules/standard/mod_auth_dbm.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_auth_dbm.c,v
retrieving revision 1.2
diff -u -r1.2 mod_auth_dbm.c
--- mod_auth_dbm.c	1999/02/07 06:29:51	1.2
+++ mod_auth_dbm.c	1999/03/23 16:44:32
@@ -218,11 +218,11 @@
     if (!sec->auth_dbmpwfile)
 	return DECLINED;
 
-    if (!(real_pw = get_dbm_pw(r, c->user, sec->auth_dbmpwfile))) {
+    if (!(real_pw = get_dbm_pw(r, r->user, sec->auth_dbmpwfile))) {
 	if (!(sec->auth_dbmauthoritative))
 	    return DECLINED;
 	ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
-		    "DBM user %s not found: %s", c->user, r->filename);
+		    "DBM user %s not found: %s", r->user, r->filename);
 	ap_note_basic_auth_failure(r);
 	return AUTH_REQUIRED;
     }
@@ -235,7 +235,7 @@
     if (invalid_pw != NULL) {
 	ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
 		      "DBM user %s: authentication failure for \"%s\": %s",
-		      c->user, r->uri, invalid_pw);
+		      r->user, r->uri, invalid_pw);
 	ap_note_basic_auth_failure(r);
 	return AUTH_REQUIRED;
     }
@@ -249,7 +249,7 @@
     dbm_auth_config_rec *sec =
     (dbm_auth_config_rec *) ap_get_module_config(r->per_dir_config,
 					      &dbm_auth_module);
-    char *user = r->connection->user;
+    char *user = r->user;
     int m = r->method_number;
 
     const array_header *reqs_arr = ap_requires(r);
Index: src/modules/standard/mod_digest.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_digest.c,v
retrieving revision 1.2
diff -u -r1.2 mod_digest.c
--- mod_digest.c	1999/02/07 06:29:52	1.2
+++ mod_digest.c	1999/03/23 16:44:33
@@ -250,8 +250,8 @@
 	return AUTH_REQUIRED;
     }
 
-    r->connection->user = response->username;
-    r->connection->ap_auth_type = "Digest";
+    r->user = response->username;
+    r->ap_auth_type = "Digest";
 
     return OK;
 }
@@ -298,15 +298,15 @@
     if (!sec->pwfile)
 	return DECLINED;
 
-    if (!(a1 = get_hash(r, c->user, sec->pwfile))) {
+    if (!(a1 = get_hash(r, r->user, sec->pwfile))) {
 	ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
-		    "user %s not found: %s", c->user, r->uri);
+		    "user %s not found: %s", r->user, r->uri);
 	ap_note_digest_auth_failure(r);
 	return AUTH_REQUIRED;
     }
     if (strcmp(response->digest, find_digest(r, response, a1))) {
 	ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
-		    "user %s: password mismatch: %s", c->user, r->uri);
+		    "user %s: password mismatch: %s", r->user, r->uri);
 	ap_note_digest_auth_failure(r);
 	return AUTH_REQUIRED;
     }
@@ -317,7 +317,7 @@
 
 static int digest_check_auth(request_rec *r)
 {
-    char *user = r->connection->user;
+    char *user = r->user;
     int m = r->method_number;
     int method_restricted = 0;
     register int x;
Index: src/modules/standard/mod_log_config.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_log_config.c,v
retrieving revision 1.3
diff -u -r1.3 mod_log_config.c
--- mod_log_config.c	1999/03/05 05:24:30	1.3
+++ mod_log_config.c	1999/03/23 16:44:34
@@ -296,7 +296,7 @@
 
 static const char *log_remote_user(request_rec *r, char *a)
 {
-    char *rvalue = r->connection->user;
+    char *rvalue = r->user;
 
     if (rvalue == NULL) {
         rvalue = "-";
Index: src/modules/standard/mod_rewrite.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_rewrite.c,v
retrieving revision 1.3
diff -u -r1.3 mod_rewrite.c
--- mod_rewrite.c	1999/03/17 17:01:53	1.3
+++ mod_rewrite.c	1999/03/23 16:44:52
@@ -3155,11 +3155,11 @@
         return;
     }
 
-    if (conn->user == NULL) {
+    if (r->user == NULL) {
         ruser = "-";
     }
-    else if (strlen(conn->user) != 0) {
-        ruser = conn->user;
+    else if (strlen(r->user) != 0) {
+        ruser = r->user;
     }
     else {
         ruser = "\"\"";
@@ -3568,7 +3568,7 @@
                                          r->per_dir_config, REMOTE_NAME);
     }
     else if (strcasecmp(var, "REMOTE_USER") == 0) {
-        result = r->connection->user;
+        result = r->user;
     }
     else if (strcasecmp(var, "REMOTE_IDENT") == 0) {
         result = (char *)ap_get_remote_logname(r);
@@ -3595,7 +3595,7 @@
         result = r->args;
     }
     else if (strcasecmp(var, "AUTH_TYPE") == 0) {
-        result = r->connection->ap_auth_type;
+        result = r->ap_auth_type;
     }
     else if (strcasecmp(var, "IS_SUBREQ") == 0) { /* non-standard */
         result = (r->main != NULL ? "true" : "false");
Index: src/modules/standard/mod_setenvif.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_setenvif.c,v
retrieving revision 1.2
diff -u -r1.2 mod_setenvif.c
--- mod_setenvif.c	1999/02/07 06:29:55	1.2
+++ mod_setenvif.c	1999/03/23 16:44:53
@@ -347,7 +347,7 @@
 					  REMOTE_NAME);
 		break;
 	    case SPECIAL_REMOTE_USER:
-		val = r->connection->user;
+		val = r->user;
 		break;
 	    case SPECIAL_REQUEST_URI:
 		val = r->uri;

_______________________________________________________________________
Ryan Bloom		rbb@raleigh.ibm.com
4205 S Miami Blvd	
RTP, NC 27709		It's a beautiful sight to see good dancers 
			doing simple steps.  It's a painful sight to
			see beginners doing complicated patterns.	


Mime
View raw message