[svn:mod_parrot] r233 - in mod_parrot/trunk: lib/Apache lib/ModParrot src

[email protected]
Newsgroups perl.cvs.mod_parrot
Message-ID <[email protected]>
Author: jhorwitz
Date: Sun Jul 29 12:39:42 2007
New Revision: 233

Modified:
   mod_parrot/trunk/lib/Apache/RequestRec.pir
   mod_parrot/trunk/lib/ModParrot/init.pir
   mod_parrot/trunk/src/nci.c

Log:
fix get_basic_auth_pw implementation


Modified: mod_parrot/trunk/lib/Apache/RequestRec.pir
==============================================================================
--- mod_parrot/trunk/lib/Apache/RequestRec.pir	(original)
+++ mod_parrot/trunk/lib/Apache/RequestRec.pir	Sun Jul 29 12:39:42 2007
@@ -244,19 +244,23 @@
     .local pmc r
     .local int offset
     .local pmc request_rec_get_basic_auth_pw
+    .local string pw
     .local int status
+    .local pmc results
 
     classoffset offset, self, 'Apache::RequestRec'
     getattribute r, self, offset
     find_global request_rec_get_basic_auth_pw, 'ModParrot::NCI', 'request_rec_get_basic_auth_pw'
 
-    # password will be stored in S15
-    status = request_rec_get_basic_auth_pw( r )
+    results = new .Array
+    results = 2
+    status = request_rec_get_basic_auth_pw( r, results )
+    status = results[0]
+    pw = results[1]
 
-    # new calling conventions
     .pcc_begin_return
         .return status
-        .return S15
+        .return pw
     .pcc_end_return
 .end
 

Modified: mod_parrot/trunk/lib/ModParrot/init.pir
==============================================================================
--- mod_parrot/trunk/lib/ModParrot/init.pir	(original)
+++ mod_parrot/trunk/lib/ModParrot/init.pir	Sun Jul 29 12:39:42 2007
@@ -40,13 +40,13 @@
     dlfunc func, nul, "mpnci_request_rec_prev", "pJp"
     store_global "ModParrot::NCI", "request_rec_prev", func
 
-    dlfunc func, nul, "mpnci_request_rec_user", "tJpt"
+    dlfunc func, nul, "mpnci_request_rec_user", "tJpti"
     store_global "ModParrot::NCI", "request_rec_user", func
 
     dlfunc func, nul, "mpnci_request_rec_notes", "pJp"
     store_global "ModParrot::NCI", "request_rec_notes", func
 
-    dlfunc func, nul, "mpnci_request_rec_get_basic_auth_pw", "iJp"
+    dlfunc func, nul, "mpnci_request_rec_get_basic_auth_pw", "iJpP"
     store_global "ModParrot::NCI", "request_rec_get_basic_auth_pw", func
 
     dlfunc func, nul, "mpnci_rwrite", "iJPip"

Modified: mod_parrot/trunk/src/nci.c
==============================================================================
--- mod_parrot/trunk/src/nci.c	(original)
+++ mod_parrot/trunk/src/nci.c	Sun Jul 29 12:39:42 2007
@@ -118,9 +118,10 @@
 
 /* We implement ap_get_basic_auth_pw as a wrapper because there is no NCI
  * signature type that handles the function's char ** password parameter.
- * Even 'B', which is "void **", doesn't work.  Should investigate further.
+ * Instead, we return the results in a PMC array passed in from the caller.
  */
-int mpnci_request_rec_get_basic_auth_pw(Parrot_Interp interp, request_rec *r)
+int mpnci_request_rec_get_basic_auth_pw(Parrot_Interp interp, request_rec *r,
+    PMC *results)
 {
     int status;
     char *pw = NULL;
@@ -131,7 +132,8 @@
     status = ap_get_basic_auth_pw(r, (const char **)&pw);
     spw = Parrot_new_string(ctxp->interp,
         pw ? pw : "", pw ? strlen(pw) : 0, "iso-8859-1", 0);
-    Parrot_set_strreg(ctxp->interp, 15, spw);
+    Parrot_PMC_set_intval_intkey(interp, results, 0, status);
+    Parrot_PMC_set_string_intkey(interp, results, 1, spw);
     return(status);
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.