CVSROOT : /cvsroot/undernet-ircu
Module : ircu2.10
Branch tags: u2_10_11_06
Commit time: 2003-11-22 17:07:52 UTC
Modified files:
Tag: u2_10_11_06
ChangeLog ircd/version.c.SH tools/wrapper.c
Log message:
Author: Kev <[EMAIL PROTECTED]>
Log message:
Fix update of generation by version.c.SH; fix a setuid/chroot problem
noticed by ubra.
---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.290.2.129.2.25 ircu2.10/ChangeLog:1.290.2.129.2.26
--- ircu2.10/ChangeLog:1.290.2.129.2.25 Sat Nov 22 08:18:22 2003
+++ ircu2.10/ChangeLog Sat Nov 22 09:07:41 2003
@@ -1,5 +1,9 @@
2003-11-22 Kevin L Mitchell <[EMAIL PROTECTED]>
+ * tools/wrapper.c: commit uid on chroot fix from ubra
+
+ * ircd/version.c.SH: fix generation generation
+
* ircd/m_nick.c (m_nick): truncate the nickname to the minimum of
the maximum allowed length (NICKLEN) or the allowed nickname
length specified as the NICKLEN feature
Index: ircu2.10/ircd/version.c.SH
diff -u ircu2.10/ircd/version.c.SH:1.3 ircu2.10/ircd/version.c.SH:1.3.18.1
--- ircu2.10/ircd/version.c.SH:1.3 Fri Apr 14 21:20:14 2000
+++ ircu2.10/ircd/version.c.SH Sat Nov 22 09:07:42 2003
@@ -2,7 +2,7 @@
if test -r version.c
then
- generation=`sed -n 's/^char \*generation = \"\(.*\)\";/\1/p' < version.c`
+ generation=`sed -n 's/^const char \*generation = \"\(.*\)\";/\1/p' < version.c`
if test ! "$generation" ; then generation=0; fi
else
generation=0
Index: ircu2.10/tools/wrapper.c
diff -u ircu2.10/tools/wrapper.c:1.1 ircu2.10/tools/wrapper.c:1.1.16.1
--- ircu2.10/tools/wrapper.c:1.1 Fri Jun 22 13:18:23 2001
+++ ircu2.10/tools/wrapper.c Sat Nov 22 09:07:42 2003
@@ -15,7 +15,7 @@
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
**
-** @(#)$Id: wrapper.c,v 1.1 2001/06/22 20:18:23 kev Exp $
+** @(#)$Id: wrapper.c,v 1.1.16.1 2003/11/22 17:07:42 klmitch Exp $
*/
#include <string.h>
#include <stdlib.h>
@@ -47,6 +47,9 @@
#endif
#endif
+/*fix for change uid/gid with chroot #ubra 08/02/03*/
+int uid, gid;
+
/*
* Set the hard and soft limits for maximum file descriptors.
*/
@@ -78,14 +81,16 @@
/*
* Change the user and group ids--including supplementary groups!--as
* appropriate.
+ *
+ * fix for change uid/gid with chroot #ubra 08/02/03
+ * old change_user() got splited into get_user() and set_user()
*/
int
-change_user(char *user, char *group)
+get_user(char *user, char *group)
{
struct passwd *pwd;
struct group *grp;
char *tmp;
- int uid, gid;
/* Track down a struct passwd describing the desired user */
uid = strtol(user, &tmp, 10); /* was the user given as a number? */
@@ -111,6 +116,11 @@
if (initgroups(pwd->pw_name, gid)) /* initialize supplementary groups */
return -1;
+ return 0; /* success! */
+}
+
+int
+set_user(void) {
if (setgid(gid)) /* change our current group */
return -1;
if (setuid(uid)) /* change our current user */
@@ -182,6 +192,13 @@
return 1;
}
+ if(user) /* get the selected user account uid/gid*/
+ if (get_user(user, group)) {
+ perror(prog);
+ return 1;
+ }
+
+
if (root) /* change root directories */
if (change_root(root)) {
perror(prog);
@@ -189,7 +206,7 @@
}
if (user) /* change to selected user account */
- if (change_user(user, group)) {
+ if (set_user()) {
perror(prog);
return 1;
}
----------------------- End of diff -----------------------