joosters                Wed Mar  7 02:28:00 2001 EDT

  Modified files:              
    /php4/sapi/isapi    php4isapi.c 
  Log:
  Added support for Zeus SSL client certificate information.
  Added SERVER_SIGNATURE to the environment.
  
  Submitted by: [EMAIL PROTECTED]
  
  
Index: php4/sapi/isapi/php4isapi.c
diff -u php4/sapi/isapi/php4isapi.c:1.69 php4/sapi/isapi/php4isapi.c:1.70
--- php4/sapi/isapi/php4isapi.c:1.69    Tue Mar  6 07:09:15 2001
+++ php4/sapi/isapi/php4isapi.c Wed Mar  7 02:28:00 2001
@@ -120,6 +120,22 @@
        "HTTPS_SERVER_ISSUER",
        "HTTPS_SERVER_SUBJECT",
        "SERVER_PORT_SECURE",
+#ifdef WITH_ZEUS
+       "SSL_CLIENT_CN",
+       "SSL_CLIENT_EMAIL",
+       "SSL_CLIENT_OU",
+       "SSL_CLIENT_O",
+       "SSL_CLIENT_L",
+       "SSL_CLIENT_ST",
+       "SSL_CLIENT_C",
+       "SSL_CLIENT_I_CN",
+       "SSL_CLIENT_I_EMAIL",
+       "SSL_CLIENT_I_OU",
+       "SSL_CLIENT_I_O",
+       "SSL_CLIENT_I_L",
+       "SSL_CLIENT_I_ST",
+       "SSL_CLIENT_I_C",       
+#endif
        NULL
 };
 
@@ -341,6 +357,40 @@
 
 
 #ifdef WITH_ZEUS
+
+static void sapi_isapi_register_zeus_ssl_variables(LPEXTENSION_CONTROL_BLOCK lpECB, 
+zval *track_vars_array ELS_DC PLS_DC)
+{
+       char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE];
+       DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
+       char static_cons_buf[ISAPI_SERVER_VAR_BUF_SIZE];
+       /*
+        * We need to construct the /C=.../ST=...
+        * DN's for SSL_CLIENT_DN and SSL_CLIENT_I_DN
+        */
+       strcpy( static_cons_buf, "/C=" );
+       if( lpECB->GetServerVariable( lpECB->ConnID, "SSL_CLIENT_C", 
+static_variable_buf, &variable_len ) && static_variable_buf[0] ) {
+               strcat( static_cons_buf, static_variable_buf );
+       }
+       strcat( static_cons_buf, "/ST=" );
+       variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
+       if( lpECB->GetServerVariable( lpECB->ConnID, "SSL_CLIENT_ST", 
+static_variable_buf, &variable_len ) && static_variable_buf[0] ) {
+               strcat( static_cons_buf, static_variable_buf );
+       }
+       php_register_variable( "SSL_CLIENT_DN", static_cons_buf, track_vars_array 
+ELS_CC PLS_CC );
+       
+       strcpy( static_cons_buf, "/C=" );
+       variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
+       if( lpECB->GetServerVariable( lpECB->ConnID, "SSL_CLIENT_I_C", 
+static_variable_buf, &variable_len ) && static_variable_buf[0] ) {
+               strcat( static_cons_buf, static_variable_buf );
+       }
+       strcat( static_cons_buf, "/ST=" );
+       variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
+       if( lpECB->GetServerVariable( lpECB->ConnID, "SSL_CLIENT_I_ST", 
+static_variable_buf, &variable_len ) && static_variable_buf[0] ) {
+               strcat( static_cons_buf, static_variable_buf );
+       }
+       php_register_variable( "SSL_CLIENT_I_DN", static_cons_buf, track_vars_array 
+ELS_CC PLS_CC );    
+}
+
 static void sapi_isapi_register_zeus_variables(LPEXTENSION_CONTROL_BLOCK lpECB, zval 
*track_vars_array ELS_DC PLS_DC)
 {
        char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE];
@@ -396,6 +446,17 @@
        variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
        if ( lpECB->GetServerVariable(lpECB->ConnID, "AUTH_TYPE", static_variable_buf, 
&variable_len) && static_variable_buf[0] )  {
                php_register_variable( "PHP_AUTH_TYPE", static_variable_buf, 
track_vars_array ELS_CC PLS_CC );
+       }
+       
+       /* And now, for the SSL variables (if applicable) */
+       variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
+       if ( lpECB->GetServerVariable(lpECB->ConnID, "CERT_COOKIE", 
+static_variable_buf, &variable_len) && static_variable_buf[0] ) {
+               sapi_isapi_register_zeus_ssl_variables( lpECB, track_vars_array ELS_CC 
+PLS_CC );
+       }
+       /* Copy some of the variables we need to meet Apache specs */
+       variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
+       if ( lpECB->GetServerVariable(lpECB->ConnID, "SERVER_SOFTWARE", 
+static_variable_buf, &variable_len) && static_variable_buf[0] )  {
+               php_register_variable( "SERVER_SIGNATURE", static_variable_buf, 
+track_vars_array ELS_CC PLS_CC );
        }
 }
 #endif



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to