[#72642] Advantages of Symbols over constants — Marek Janukowicz <childNOSPAM@...17.ds.pwr.wroc.pl>

11 messages 2003/06/01

[#72732] case of sub! not working — Ian Macdonald <ian@...>

Hi,

27 messages 2003/06/03
[#72734] Re: case of sub! not working — Joel VanderWerf <vjoel@...> 2003/06/03

Ian Macdonald wrote:

[#72744] Re: case of sub! not working — Ian Macdonald <ian@...> 2003/06/03

On Tue 03 Jun 2003 at 10:21:43 +0900, Joel VanderWerf wrote:

[#72769] Re: case of sub! not working — Michael Campbell <michael_s_campbell@...> 2003/06/03

[#72907] Syck 0.35 + YAML.rb 0.60 -- the 1st stable release — why the lucky stiff <ruby-talk@...>

Pleased to announce:

18 messages 2003/06/05
[#75182] Re: Syck 0.35 + YAML.rb 0.60 -- the 1st stable release — Richard Zidlicky <rz@...68k.org> 2003/07/04

On Fri, Jun 06, 2003 at 06:15:58AM +0900, why the lucky stiff wrote:

[#72908] Problem with "require" stmt in "test-first " tutorial — RLMuller@... (Richard)

Hi All,

27 messages 2003/06/05

[#72940] VAPOR 0.06, Transparent Persistence to PostgreSQL — "Oliver M. Bolzer" <oliver@...>

Hi!

22 messages 2003/06/06

[#72975] join block — "Simon Strandgaard" <0bz63fz3m1qt3001@...>

29 messages 2003/06/06

[#72986] multiple blocks or proc arguments to method — itsme213@... (you CAN teach an old dog ...)

I was trying to write a collect_if method:

11 messages 2003/06/07

[#73081] requiring standard libs with save level 1 — Eugene Scripnik <Eugene.Scripnik@...>

I've set up new version of Ruby from CVS and my programs failed to work.

13 messages 2003/06/09
[#73114] Re: requiring standard libs with save level 1 — matz@... (Yukihiro Matsumoto) 2003/06/09

Hi,

[#73134] tcltklib does not get compiled. — John Fletcher <J.P.Fletcher@...>

I have installed ruby 1.6.7 on two computers using Red Hat 8.0 Linux.

14 messages 2003/06/10

[#73148] OT: Regexp question — Dominik Werder <dwerder@...>

Hi all,

25 messages 2003/06/10

[#73215] Rubyx (provisionally named) linux distro. Made by and run by Ruby — Andrew Walrond <andrew@...>

I have developed a little script which creates a simple linux distro

38 messages 2003/06/11

[#73260] Multiple Initialize methods? — "Nick" <nick.robinson@...>

Hi,

21 messages 2003/06/11

[#73283] Ruby advantages over Perl — Marek Janukowicz <childNOSPAM@...17.ds.pwr.wroc.pl>

68 messages 2003/06/11
[#73374] Re: Ruby advantages over Perl — Jason Creighton <androflux@...> 2003/06/12

On Thu, 12 Jun 2003 17:56:02 +0900

[#73356] does each work on a copy? — Rasputin <rasputin@...>

17 messages 2003/06/12

[#73372] Reason for implicit block syntax ? — itsme213@... (you CAN teach an old dog ...)

What is the reason for the implicit block in Ruby invocations?

13 messages 2003/06/12

[#73463] Hispeed String concat — Dominik Werder <dwerder@...>

What is the fastest way to add many small Strings to a big buffer?

17 messages 2003/06/13

[#73503] RaaInstallInRuby petition — ptkwt@...1.aracnet.com (Phil Tomson)

18 messages 2003/06/13

[#73555] I need a code beautifier or formatter — joaopedrosa@... (Joao Pedrosa)

Hello,

13 messages 2003/06/14

[#73600] Get songtitle from Winamp — calvin8@... (Andi Scharfstein)

Hi,

26 messages 2003/06/15
[#73601] Re: Get songtitle from Winamp — Daniel Carrera <dcarrera@...> 2003/06/15

-----BEGIN PGP SIGNED MESSAGE-----

[#73602] Re: Get songtitle from Winamp — Chad Fowler <chadfowler@...> 2003/06/15

It's a Win32API convention meaning "Window Handle".

[#73603] Re: Get songtitle from Winamp — Daniel Carrera <dcarrera@...> 2003/06/15

-----BEGIN PGP SIGNED MESSAGE-----

[#73605] Re: Get songtitle from Winamp — Wesley J Landaker <wjl@...> 2003/06/15

On Sunday 15 June 2003 9:34 am, Daniel Carrera wrote:

[#73609] Re: Get songtitle from Winamp — Daniel Carrera <dcarrera@...> 2003/06/15

-----BEGIN PGP SIGNED MESSAGE-----

[#73640] Standardizing Installers — Tom Clarke <tom@...2i.com>

I was thinking about some of the issues raised involving ruby libraries

16 messages 2003/06/16

[#73663] /BEGIN/ .. /END/ file reading — Wild Karl-Heinz <kh.wild@...>

hello

15 messages 2003/06/16
[#73674] Re: /BEGIN/ .. /END/ file reading — "Robert Klemme" <bob.news@...> 2003/06/16

[#73677] Re: /BEGIN/ .. /END/ file reading — Michael Campbell <michael_s_campbell@...> 2003/06/16

> A range operator with a regexp works like a flip flop (bistable

[#73680] Multiline comments? — "Christoph Tapler" <christoph.tapler@...>

I'm new to Ruby and I'm wondering that there is no possibility to write

38 messages 2003/06/16

[#73781] editor / ide recommentation on Windows — itsme213@... (you CAN teach an old dog ...)

What editor / ide would you recommend for serious Ruby work on

20 messages 2003/06/17

[#73787] Array#push(empty array expanded) => no exception — "Simon Strandgaard" <0bz63fz3m1qt3001@...>

This strange behavier really surprised me..

13 messages 2003/06/17

[#73821] European Ruby Conference — "Hal E. Fulton" <hal9000@...>

I don't think I've mentioned this before, but I

15 messages 2003/06/17

[#73924] Re: TCP/IP protocol and Net::HTTP — "J.Hawkesworth" <J.Hawkesworth@...>

Works for me too.

13 messages 2003/06/19
[#73931] Re: TCP/IP protocol and Net::HTTP — Nigel Gilbert <n.gilbert@...> 2003/06/19

I am beginning to wonder if this problem arises from the MacOS X

[#73943] collect info about ruby-api — "Simon Strandgaard" <0bz63fz3m1qt3001@...>

I have long been longing for a good description of ruby C api.

35 messages 2003/06/19

[#74039] WxRuby status? — ptkwt@...1.aracnet.com (Phil Tomson)

14 messages 2003/06/20
[#74507] Re: WxRuby status? — Richard Kilmer <rich@...> 2003/06/26

Things are progressing great. Kevin Smith has taken the development

[#74070] How to test if a file exists? — Daniel Carrera <dcarrera@...>

-----BEGIN PGP SIGNED MESSAGE-----

12 messages 2003/06/21

[#74096] Exasperated with ruby/tk - anybody successfully using it? — "Richard Browne" <richb@...>

General question: Is ruby/tk still being maintained in 1.7/1.8 or is it

10 messages 2003/06/22

[#74104] String#decorate — martindemello@... (Martin DeMello)

When chaining methods, it'd be neat to have something that was passed

17 messages 2003/06/22

[#74156] Marshal bug? — Anders Borch <spam@...>

Hi!

15 messages 2003/06/23
[#74161] Re: Marshal bug? — Dave Thomas <dave@...> 2003/06/23

Anders Borch wrote:

[#74205] can't find appropriate regexp — "Patrick Zesar" <jonnypichler@...>

spamassassin blocked my previous post :-((((

17 messages 2003/06/23

[#74279] Ruby Developer's Guide - hurt book sale — dennis@... (Dennis Sutch)

Syngress Publishing is having a hurt book sale. Per Syngress

11 messages 2003/06/24

[#74379] protect parents from children — "Simon Strandgaard" <0bz63fz3m1qt3001@...>

I fell into these pitfalls yesterday.. that a child was modifying a parent!

27 messages 2003/06/25

[#74413] Ruby/Java integration through JNI: working implementation — Mauricio Fern疣dez <batsman.geo@...>

14 messages 2003/06/25
[#74436] Re: Ruby/Java integration through JNI: working implementation — D T <tran55555@...> 2003/06/25

Yet An other JRuby ?? :-)

[#74465] DBD for Oracle9i — Jim Cain <list@...>

Hi all. I was looking for a Ruby interface to 9i that would handle all

25 messages 2003/06/25

[#74478] RPM for 1.8.0 — John Carter <john.carter@...>

I would like to get / build a Mandrake 9.1 RPM for Ruby-1.8.0 Preview 3

17 messages 2003/06/26

[#74506] String#split(' ') and whitespace (perl user's surprise) — mike@... (Mike Stok)

I have to confess that I use a lot of Perl, and some of its idioms are

15 messages 2003/06/26

[#74573] Using & for arrays of objects — "Krishna Dole" <kpdole@...>

Hi,

39 messages 2003/06/27

[#74579] why can't I use $3somevar for global variable in ruby 1.8.0? — Donglai Gong <donglai@...>

Hi, I'm new to Ruby programming and I just upgraded from 1.6.8 to 1.8.0

10 messages 2003/06/27

[#74702] Slides from my talk are up on rubyhacker.com — "Hal E. Fulton" <hal9000@...>

I was pleased to attend the European Ruby Conference

25 messages 2003/06/29

[#74706] Help with UnboundMethod#bind error — gabriele renzi <surrender_it@...1.vip.lng.yahoo.com>

Hi gurus and nubys,

16 messages 2003/06/29
[#74708] Re: Help with UnboundMethod#bind error — nobu.nokada@... 2003/06/29

Hi,

[#74732] Re: Help with UnboundMethod#bind error — matz@... (Yukihiro Matsumoto) 2003/06/30

Hi,

[#74919] Re: Help with UnboundMethod#bind error — "Pit Capitain" <pit@...> 2003/07/02

On 30 Jun 2003 at 17:18, Yukihiro Matsumoto wrote:

[#74717] Re: Message catalogs (I18N) overnight hack... — "Hal E. Fulton" <hal9000@...>

----- Original Message -----

17 messages 2003/06/29

[#74747] Editor like Textpad on Linux? — Dominik Werder <dwerder@...>

Hello,

13 messages 2003/06/30

[#74768] dynamic object creation — Aryeh Friedman <aryeh@...>

If I have something like this:

15 messages 2003/06/30

Re: setuid/setgid ruby scripts

From: nobu.nokada@...
Date: 2003-06-03 02:48:45 UTC
List: ruby-talk #72741
Hi,

At Tue, 3 Jun 2003 10:29:16 +0900,
Wesley J Landaker wrote:
> So, I made a "better" version that was just:
> #include <unistd.h>
> int main(int argc, char *argv[]) {
>   const char *script = "/absolute/path/to/ruby/script.rb"
>   execv(script, argv);
> }
> And then setuid the result.

A perl script creates such wrappers can be found in Camel book.

> Anyway, I was just wondering if anyone has ever needed to make a ruby 
> script setuid or setgid before--and if so, how did you go about doing 
> it? 

I had, but suid/sgid security issue has not been discussed
about enough yet.


Index: Makefile.in
===================================================================
RCS file: /cvs/ruby/src/ruby/Makefile.in,v
retrieving revision 1.44
diff -u -2 -p -r1.44 Makefile.in
--- Makefile.in	21 May 2003 11:51:55 -0000	1.44
+++ Makefile.in	3 Jun 2003 02:27:18 -0000
@@ -36,7 +36,9 @@ MAINLIBS = @MAINLIBS@
 
 RUBY_INSTALL_NAME=@RUBY_INSTALL_NAME@
+SRUBY_INSTALL_NAME=@SRUBY_INSTALL_NAME@
 RUBY_SO_NAME=@RUBY_SO_NAME@
 EXEEXT = @EXEEXT@
 PROGRAM=$(RUBY_INSTALL_NAME)$(EXEEXT)
+SPROGRAM=$(SRUBY_INSTALL_NAME)$(EXEEXT)
 RUBY = $(RUBY_INSTALL_NAME)
 MINIRUBY = @MINIRUBY@
@@ -119,4 +121,8 @@ $(PROGRAM):     $(LIBRUBY) $(MAINOBJ) $(
 		$(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@
 
+$(SPROGRAM):	$(LIBRUBY) $(MAINOBJ) $(EXTOBJS) suid.@OBJEXT@
+		@rm -f $@
+		$(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(OUTFLAG)$@ $(MAINLIBS) $(MAINOBJ) $(EXTOBJS) suid.@OBJEXT@ $(LIBRUBYARG) $(LIBS)
+
 $(LIBRUBY_A):	$(OBJS) dmyext.@OBJEXT@
 		@AR@ rcu $@ $(OBJS) dmyext.@OBJEXT@
@@ -360,2 +366,3 @@ variable.@OBJEXT@: variable.c ruby.h con
 version.@OBJEXT@: version.c ruby.h config.h defines.h intern.h missing.h \
   version.h
+suid.@OBJEXT@: suid.c missing.h ruby.h rubyio.h
Index: configure.in
===================================================================
RCS file: /cvs/ruby/src/ruby/configure.in,v
retrieving revision 1.173
diff -u -2 -p -r1.173 configure.in
--- configure.in	1 Jun 2003 12:58:56 -0000	1.173
+++ configure.in	1 Jun 2003 16:16:56 -0000
@@ -379,5 +379,5 @@ AC_CHECK_FUNCS(fmod killpg wait4 waitpid
 	      getpgrp setpgrp getpgid setpgid getgroups getpriority getrlimit\
 	      dlopen sigprocmask sigaction _setjmp setsid telldir seekdir fchmod\
-	      mktime timegm cosh sinh tanh)
+	      mktime timegm cosh sinh tanh group_member)
 AC_STRUCT_TIMEZONE
 AC_CACHE_CHECK(for struct tm.tm_gmtoff, rb_cv_member_struct_tm_tm_gmtoff,
@@ -993,4 +993,25 @@ esac
 AC_SUBST(setup)
 
+case $target_os in
+cygwin*|mswin*|mingw*|djgpp*|os2_emx*|human*);;
+*)
+  AC_CACHE_CHECK([for setuid/setgid supported],
+    rb_cv_setugid,
+    [AC_TRY_CPP([
+#include <sys/stat.h>
+#ifndef S_ISUID
+#ifndef S_ISGID
+#error setuid/setgid not supported
+#endif
+#endif
+    ],
+    rb_cv_setugid=yes,
+    rb_cv_setugid=no)])
+  if test "$rb_cv_setugid" = yes; then
+    AC_LIBOBJ([suiddmy])
+  fi
+  ;;
+esac
+
 if test "$prefix" = NONE; then
   prefix=$ac_default_prefix
@@ -1213,4 +1234,5 @@ AC_SUBST(LIBRUBY_LDSHARED)
 AC_SUBST(LIBRUBY_DLDFLAGS)
 AC_SUBST(RUBY_INSTALL_NAME)
+AC_SUBST(SRUBY_INSTALL_NAME)
 AC_SUBST(rubyw_install_name)
 AC_SUBST(RUBYW_INSTALL_NAME)
@@ -1245,4 +1267,5 @@ test "$program_suffix" != NONE &&
 
 RUBY_INSTALL_NAME="${ri_prefix}ruby${ri_suffix}"
+SRUBY_INSTALL_NAME="${ri_prefix}suidruby${ri_suffix}"
 case "$target_os" in
   cygwin*|mingw*)
Index: file.c
===================================================================
RCS file: /cvs/ruby/src/ruby/file.c,v
retrieving revision 1.146
diff -u -2 -p -r1.146 file.c
--- file.c	19 May 2003 05:41:07 -0000	1.146
+++ file.c	19 May 2003 06:06:56 -0000
@@ -425,5 +425,6 @@ rb_file_lstat(obj)
 }
 
-static int
+#ifndef HAVE_GROUP_MEMBER
+int
 group_member(gid)
     GETGROUPS_T gid;
@@ -454,4 +455,5 @@ group_member(gid)
     return Qfalse;
 }
+#endif
 
 #ifndef S_IXUGO
Index: ruby.c
===================================================================
RCS file: /cvs/ruby/src/ruby/ruby.c,v
retrieving revision 1.77
diff -u -2 -p -r1.77 ruby.c
--- ruby.c	22 Apr 2003 11:58:08 -0000	1.77
+++ ruby.c	22 Apr 2003 15:40:17 -0000
@@ -25,4 +25,5 @@
 #include <stdio.h>
 #include <sys/types.h>
+#include <sys/stat.h>
 #include <ctype.h>
 
@@ -793,4 +794,8 @@ load_file(fname, script)
 		rb_io_binmode(f);
 	}
+#elif defined S_ISUID || defined S_ISGID
+	if (script) {
+	    ruby_check_loadable(f);
+	}
 #endif
     }
Index: suid.c
===================================================================
RCS file: suid.c
diff -N suid.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ suid.c	3 Oct 2001 01:55:06 -0000
@@ -0,0 +1,150 @@
+/**********************************************************************
+
+  suid.c -
+
+  $Author$
+  $Date$
+  created at: Wed Aug 29 13:45:03 JST 2001
+
+  This file is covered under the Ruby's license (see the file
+  COPYING).
+
+**********************************************************************/
+
+#include "ruby.h"
+#include "rubyio.h"
+#include <errno.h>
+#include <sys/stat.h>
+
+#if !defined S_ISUID && !defined S_ISGID
+#error "setuid/setgid not supported"
+#endif
+
+void
+ruby_check_loadable(f)
+    VALUE f;
+{
+    OpenFile *fptr;
+    struct stat st;
+    int setid = 0;
+    int uid, euid, gid, egid;
+#ifdef HAVE_SETRESUID
+    int suid;
+#endif
+#ifdef HAVE_SETRESGID
+    int sgid;
+#endif
+
+    rb_check_type(f, T_FILE);
+    GetOpenFile(f, fptr);
+    if (fstat(fileno(fptr->f), &st) == -1) {
+	rb_sys_fail(fptr->path);
+    }
+
+#ifdef HAVE_SETRESUID
+    getresuid(&uid, &euid, &suid);
+#else
+    uid = (int)getuid();
+    euid = (int)geteuid();
+#endif
+#ifdef HAVE_SETRESGID
+    getresgid(&gid, &egid, &sgid);
+#else
+    gid = (int)getgid();
+    egid = (int)getegid();
+#endif
+
+    if (uid != 0) {
+	if ((
+#if defined S_IRUSR || defined S_IXUSR
+	    (st.st_uid == uid) ?
+	    !(st.st_mode & (0
+#ifdef S_IRUSR
+			    |S_IRUSR
+#endif
+#ifdef S_IXUSR
+			    |S_IXUSR
+#endif
+		)) :
+#endif
+#if defined S_IRGRP || defined S_IXGRP
+	    group_member(st.st_gid) ?
+	    !(st.st_mode & (0
+#ifdef S_IRGRP
+			    |S_IRGRP
+#endif
+#ifdef S_IXGRP
+			    |S_IXGRP
+#endif
+		)) :
+#endif
+#if defined S_IROTH || defined S_IXOTH
+	    !(st.st_mode & (0
+#ifdef S_IROTH
+			    |S_IROTH
+#endif
+#ifdef S_IXOTH
+			    |S_IXOTH
+#endif
+		))
+#else
+	    0
+#endif
+	    )
+#if defined S_ISUID && defined S_IWGRP
+	    || !(~st.st_mode & (S_ISUID|S_IWGRP))
+#endif
+#if defined S_ISUID && defined S_IWOTH
+	    || !(~st.st_mode & (S_ISUID|S_IWOTH))
+#endif
+#if defined S_ISGID && defined S_IWOTH
+	    || !(~st.st_mode & (S_ISGID|S_IWOTH))
+#endif
+	    ) {
+	    errno = EACCES;
+	    rb_load_fail(fptr->path);
+	}
+    }
+
+#ifdef S_ISGID
+    if (st.st_mode & S_ISGID) {
+# if defined HAVE_SETEGID
+	setegid(st.st_gid);
+# elif defined HAVE_SETREGID
+	setregid(-1, st.st_gid);
+# else
+	setgid(st.st_gid);
+# endif
+	setid = 1;
+    }
+    else
+#endif
+#if defined HAVE_SETRESGID && defined HAVE_SETEGID
+	setegid(sgid);
+#else
+	setgid(gid);
+#endif
+
+#ifdef S_ISUID
+    if (st.st_mode & S_ISUID) {
+# if defined HAVE_SETEUID
+	seteuid(st.st_uid);
+# elif defined HAVE_SETREUID
+	setreuid(-1, st.st_uid);
+# else
+	setuid(st.st_uid);
+# endif
+	setid = 1;
+    }
+    else
+#endif
+#if defined HAVE_SETRESUID && defined HAVE_SETEUID
+	seteuid(suid);
+#else
+	setuid(uid);
+#endif
+
+    if (!setid) {
+	rb_loaderror("not setuid/setgid -- %s", fptr->path);
+    }
+}
Index: suiddmy.c
===================================================================
RCS file: suiddmy.c
diff -N suiddmy.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ suiddmy.c	6 Sep 2001 10:25:58 -0000
@@ -0,0 +1,4 @@
+void
+ruby_check_loadable()
+{
+}


-- 
Nobu Nakada

In This Thread