You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by st...@apache.org on 2006/01/18 22:47:38 UTC

svn commit: r370270 - in /perl/modperl/trunk: Changes t/response/TestApache/daemon.pm xs/Apache2/ServerUtil/Apache2__ServerUtil.h xs/maps/modperl_functions.map

Author: stas
Date: Wed Jan 18 13:47:36 2006
New Revision: 370270

URL: http://svn.apache.org/viewcvs?rev=370270&view=rev
Log:
Add perl API corresponding to User and Group directives in httpd.conf: 
Apache2::ServerUtil->user_id and Apache2::ServerUtil->group_id

Added:
    perl/modperl/trunk/t/response/TestApache/daemon.pm   (with props)
Modified:
    perl/modperl/trunk/Changes
    perl/modperl/trunk/xs/Apache2/ServerUtil/Apache2__ServerUtil.h
    perl/modperl/trunk/xs/maps/modperl_functions.map

Modified: perl/modperl/trunk/Changes
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?rev=370270&r1=370269&r2=370270&view=diff
==============================================================================
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Wed Jan 18 13:47:36 2006
@@ -12,6 +12,10 @@
 
 =item 2.0.3-dev
 
+Add perl API corresponding to User and Group directives in httpd.conf: 
+Apache2::ServerUtil->user_id and Apache2::ServerUtil->group_id
+[Stas]
+
 Apache2::Reload now first unloads all modified modules before
 trying to reload them. This way, inter-module dependencies
 are more likely to be correctly satisfied when reloaded

Added: perl/modperl/trunk/t/response/TestApache/daemon.pm
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/response/TestApache/daemon.pm?rev=370270&view=auto
==============================================================================
--- perl/modperl/trunk/t/response/TestApache/daemon.pm (added)
+++ perl/modperl/trunk/t/response/TestApache/daemon.pm Wed Jan 18 13:47:36 2006
@@ -0,0 +1,39 @@
+package TestApache::daemon;
+
+# Apache2::ServerUtil tests
+
+use strict;
+use warnings FATAL => 'all';
+
+use Apache2::ServerUtil ();
+
+use Apache::TestConfig ();
+use Apache::TestUtil;
+use Apache::Test;
+
+use constant WIN32 => Apache::TestConfig::WIN32 || Apache::TestConfig::CYGWIN;
+
+use Apache2::Const -compile => 'OK';
+
+sub handler {
+    my $r = shift;
+
+    plan $r, tests => 2;
+
+    my $user_id = Apache2::ServerUtil->user_id;
+    my $user_id_expected = WIN32 ? 0 : $<;
+
+    ok t_cmp $user_id, $user_id_expected, "user id";
+
+    my $group_id = Apache2::ServerUtil->group_id;
+    my ($group_id_expected) = WIN32 ? 0 : ($( =~ /^(\d+)/);
+
+    ok t_cmp $group_id, $group_id_expected, "group id";
+
+    Apache2::Const::OK;
+}
+
+1;
+
+__END__
+

Propchange: perl/modperl/trunk/t/response/TestApache/daemon.pm
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: perl/modperl/trunk/xs/Apache2/ServerUtil/Apache2__ServerUtil.h
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/Apache2/ServerUtil/Apache2__ServerUtil.h?rev=370270&r1=370269&r2=370270&view=diff
==============================================================================
--- perl/modperl/trunk/xs/Apache2/ServerUtil/Apache2__ServerUtil.h (original)
+++ perl/modperl/trunk/xs/Apache2/ServerUtil/Apache2__ServerUtil.h Wed Jan 18 13:47:36 2006
@@ -13,6 +13,10 @@
  * limitations under the License.
  */
 
+#if !defined(OS2) && !defined(WIN32) && !defined(BEOS)  && !defined(NETWARE)
+#include "unixd.h"
+#endif
+
 #define mpxs_Apache2__ServerUtil_restart_count modperl_restart_count
 
 #define mpxs_Apache2__ServerRec_method_register(s, methname)     \
@@ -150,6 +154,14 @@
     modperl_dir_config(aTHX_ NULL, s, key, sv_val)
 
 #define mpxs_Apache2__ServerUtil_server(classname) modperl_global_get_server_rec()
+
+#if !defined(OS2) && !defined(WIN32) && !defined(BEOS)  && !defined(NETWARE)
+#define mpxs_Apache2__ServerUtil_user_id(classname)  unixd_config.user_id
+#define mpxs_Apache2__ServerUtil_group_id(classname) unixd_config.group_id
+#else
+#define mpxs_Apache2__ServerUtil_user_id(classname)  0
+#define mpxs_Apache2__ServerUtil_group_id(classname) 0
+#endif
 
 static MP_INLINE
 int mpxs_Apache2__ServerRec_is_perl_option_enabled(pTHX_ server_rec *s,

Modified: perl/modperl/trunk/xs/maps/modperl_functions.map
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/maps/modperl_functions.map?rev=370270&r1=370269&r2=370270&view=diff
==============================================================================
--- perl/modperl/trunk/xs/maps/modperl_functions.map (original)
+++ perl/modperl/trunk/xs/maps/modperl_functions.map Wed Jan 18 13:47:36 2006
@@ -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