>>> Another concern is windows - so if someone can try to build with this
>>> patch on windows that would be great.
>
>
>> Patch looks good, at least on Linux/OSX it passes all tests 100%.
>> It certainly would be nice to get feedback for win32 platforms before
>> checking it in. Otherwise, I think it's a good idea.
>
> It should probably return 0 and 0 on win32.

The attached patch hopefully has it right.

But my main concern is the API, if everybody happy about it, I'll just commit it and then we will polish the corners...

--
_____________________________________________________________
Stas Bekman mailto:[EMAIL PROTECTED]  http://stason.org/
MailChannels: Assured Messaging(TM) http://mailchannels.com/
The "Practical mod_perl" book       http://modperlbook.org/
http://perl.apache.org/ http://perl.org/ http://logilune.com/

Index: xs/maps/modperl_functions.map
===================================================================
--- xs/maps/modperl_functions.map       (revision 367390)
+++ xs/maps/modperl_functions.map       (working copy)
@@ -87,6 +87,8 @@
 
 MODULE=Apache2::ServerUtil   PACKAGE=Apache2::ServerUtil
  server_rec *:DEFINE_server | | SV *:classname=Nullsv
+ uid_t:DEFINE_user_id       | | SV *:classname=Nullsv
+ gid_t:DEFINE_group_id      | | SV *:classname=Nullsv
 
 MODULE=Apache2::Connection
  mpxs_Apache2__Connection_client_socket | | c, s=NULL
Index: xs/Apache2/ServerUtil/Apache2__ServerUtil.h
===================================================================
--- xs/Apache2/ServerUtil/Apache2__ServerUtil.h (revision 367390)
+++ xs/Apache2/ServerUtil/Apache2__ServerUtil.h (working copy)
@@ -13,6 +13,10 @@
  * limitations under the License.
  */
 
+#ifndef WIN32
+#include "unixd.h"
+#endif
+
 #define mpxs_Apache2__ServerUtil_restart_count modperl_restart_count
 
 #define mpxs_Apache2__ServerRec_method_register(s, methname)     \
@@ -151,6 +155,14 @@
 
 #define mpxs_Apache2__ServerUtil_server(classname) 
modperl_global_get_server_rec()
 
+#ifdef WIN32
+#define mpxs_Apache2__ServerUtil_user_id(classname) 0
+#define mpxs_Apache2__ServerUtil_group_id(classname) 0
+#else
+#define mpxs_Apache2__ServerUtil_user_id(classname) unixd_config.user_id
+#define mpxs_Apache2__ServerUtil_group_id(classname) unixd_config.group_id
+#endif
+
 static MP_INLINE
 int mpxs_Apache2__ServerRec_is_perl_option_enabled(pTHX_ server_rec *s,
                                                const char *name)
Index: t/response/TestApache/daemon.pm
===================================================================
--- t/response/TestApache/daemon.pm     (revision 0)
+++ t/response/TestApache/daemon.pm     (revision 0)
@@ -0,0 +1,34 @@
+package TestApache::daemon;
+
+# Apache2::ServerUtil tests
+
+use strict;
+use warnings FATAL => 'all';
+
+use Apache2::ServerUtil ();
+
+use Apache::TestUtil;
+use Apache::Test;
+
+use Apache2::Const -compile => 'OK';
+
+sub handler {
+    my $r = shift;
+
+    plan $r, tests => 2;
+
+    my $user_id = Apache2::ServerUtil->user_id;
+    ok t_cmp $user_id, $<, "user id";
+
+    my $group_id = Apache2::ServerUtil->group_id;
+    my ($expected_gid) = ($( =~ /^(\d+)/);
+
+    ok t_cmp $group_id, $expected_gid, "group id";
+
+    Apache2::Const::OK;
+}
+
+1;
+
+__END__
+

Property changes on: t/response/TestApache/daemon.pm
___________________________________________________________________
Name: svn:eol-style
   + native


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to