[vhffs-dev] [1320] added various patches

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1320
Author:   gradator
Date:     2008-12-24 16:58:02 +0100 (Wed, 24 Dec 2008)

Log Message:
-----------
added various patches

Added Paths:
-----------
    trunk/vhffs-packages/patches/mydns-1.1.0-7etch1-fix-bug-long-txt-reply.patch
    trunk/vhffs-packages/patches/suphp-0.6.2-1+etch0-directorygroupcheck.patch
    trunk/vhffs-packages/patches/tfsyscall-0.1.0-2.6.24.4.patch
    trunk/vhffs-packages/patches/tfsyscall-0.1.1-2.6.23.16.patch
    trunk/vhffs-packages/patches/tfsyscall-0.1.1-2.6.25.11.patch


Added: trunk/vhffs-packages/patches/mydns-1.1.0-7etch1-fix-bug-long-txt-reply.patch
===================================================================
--- trunk/vhffs-packages/patches/mydns-1.1.0-7etch1-fix-bug-long-txt-reply.patch	                        (rev 0)
+++ trunk/vhffs-packages/patches/mydns-1.1.0-7etch1-fix-bug-long-txt-reply.patch	2008-12-24 15:58:02 UTC (rev 1320)
@@ -0,0 +1,12 @@
+diff -Nru a/src/mydns/reply.c b/src/mydns/reply.c
+--- a/src/mydns/reply.c	2008-11-07 15:22:55.000000000 +0100
++++ b/src/mydns/reply.c	2008-11-07 15:22:43.000000000 +0100
+@@ -571,7 +571,7 @@
+ reply_add_txt(TASK *t, RR *r)
+ {
+ 	char		*dest;
+-	char		size;
++	size_t		size;
+ 	size_t	len;
+ 	MYDNS_RR	*rr = (MYDNS_RR *)r->rr;
+ 

Added: trunk/vhffs-packages/patches/suphp-0.6.2-1+etch0-directorygroupcheck.patch
===================================================================
--- trunk/vhffs-packages/patches/suphp-0.6.2-1+etch0-directorygroupcheck.patch	                        (rev 0)
+++ trunk/vhffs-packages/patches/suphp-0.6.2-1+etch0-directorygroupcheck.patch	2008-12-24 15:58:02 UTC (rev 1320)
@@ -0,0 +1,52 @@
+diff -Nru a/src/Application.cpp b/src/Application.cpp
+--- a/src/Application.cpp	2008-04-18 22:40:00.000000000 +0000
++++ b/src/Application.cpp	2008-04-18 22:40:35.000000000 +0000
+@@ -361,8 +361,8 @@
+ #endif // OPT_USERGROUP_PARANOID    
+     
+     // Check directory ownership and permissions
+-    checkParentDirectories(realScriptFile, targetUser, config);
+-    checkParentDirectories(scriptFile, targetUser, config);
++    checkParentDirectories(realScriptFile, targetUser, targetGroup, config);
++    checkParentDirectories(scriptFile, targetUser, targetGroup, config);
+     
+     // Common code used for all modes
+ 
+@@ -559,17 +559,20 @@
+ 
+ 
+ void suPHP::Application::checkParentDirectories(const File& file,
+-                                               const UserInfo& owner,
++                                               const UserInfo& user,
++                                               const GroupInfo& group,
+                                                const Configuration& config) const throw (SoftException) {
+     File directory = file;
+     Logger& logger = API_Helper::getSystemAPI().getSystemLogger();
+     do {
+         directory = directory.getParentDirectory();
+         
+-        UserInfo directoryOwner = directory.getUser();
+-        if (directoryOwner != owner && !directoryOwner.isSuperUser()) {
++
++        UserInfo directoryUser = directory.getUser();
++	GroupInfo directoryGroup = directory.getGroup();
++        if (directoryGroup != group && !directoryUser.isSuperUser()) {
+             std::string error = "Directory " + directory.getPath()
+-                + " is not owned by " + owner.getUsername();
++                + " is not owned by group " + group.getGroupname();
+             logger.logWarning(error);
+             throw SoftException(error, __FILE__, __LINE__);
+         }
+diff -Nru a/src/Application.hpp b/src/Application.hpp
+--- a/src/Application.hpp	2008-04-18 22:39:24.000000000 +0000
++++ b/src/Application.hpp	2008-04-18 22:40:13.000000000 +0000
+@@ -112,7 +112,8 @@
+           * Checks ownership and permissions for parent directories
+           */
+          void checkParentDirectories(const File& file,
+-                                     const UserInfo& owner,
++                                     const UserInfo& user,
++                                     const GroupInfo& group,
+                                      const Configuration& config) const
+              throw (SoftException);
+ 

Added: trunk/vhffs-packages/patches/tfsyscall-0.1.0-2.6.24.4.patch
===================================================================
--- trunk/vhffs-packages/patches/tfsyscall-0.1.0-2.6.24.4.patch	                        (rev 0)
+++ trunk/vhffs-packages/patches/tfsyscall-0.1.0-2.6.24.4.patch	2008-12-24 15:58:02 UTC (rev 1320)
@@ -0,0 +1,86 @@
+diff -Nru a/fs/open.c b/fs/open.c
+--- a/fs/open.c	2008-04-13 23:59:09.000000000 +0200
++++ b/fs/open.c	2008-04-14 01:44:27.000000000 +0200
+@@ -1083,7 +1083,7 @@
+ 
+ EXPORT_SYMBOL(fd_install);
+ 
+-long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
++long old_do_sys_open(int dfd, const char __user *filename, int flags, int mode)
+ {
+ 	char *tmp = getname(filename);
+ 	int fd = PTR_ERR(tmp);
+@@ -1105,6 +1105,73 @@
+ 	return fd;
+ }
+ 
++
++long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
++{
++	long fd;
++	struct file *f;
++	struct dentry *d;
++	struct inode *inode;
++	struct group_info *gi;
++	long ngroups,i,j;
++
++	fd = old_do_sys_open( dfd , filename , flags , mode );
++
++	if( fd < 0 )
++		return fd;
++
++	if( current->uid < 10000 && current->gid < 10000 )
++		return fd;
++
++	f = fget( fd );
++	if( f == NULL )  {
++		sys_close( fd );
++		return -EACCES;
++	}
++
++	d = f->f_dentry;
++	if( d == NULL )  {
++		fput( f );
++		sys_close( fd );
++		return -EACCES;
++	}
++
++	inode = d->d_inode;
++	if( inode == NULL )  {
++		fput( f );
++		sys_close( fd );
++		return -EACCES;
++	}
++
++	/* allow open() on system files */
++	if( inode->i_uid < 10000 && inode->i_gid < 10000 )  {
++		fput( f );
++		return fd;
++	}
++
++	/* check if the file belong to one of the user group */
++	get_group_info( current->group_info );
++	gi = current->group_info;
++	ngroups = gi->ngroups;
++	for( i = 0 ; i < gi->nblocks ; i++)  {
++		long cp_count = min( (long)NGROUPS_PER_BLOCK, ngroups );
++		for( j = 0 ; j < cp_count ; j++ )  {
++			if( gi->blocks[i][j] == inode->i_gid )  {
++				put_group_info( gi );
++				fput( f );
++				return fd;
++			}
++		}
++		ngroups -= NGROUPS_PER_BLOCK;
++	}
++	put_group_info( current->group_info );
++
++	fput( f );
++	sys_close( fd );
++	return -EACCES;
++}
++
++
+ asmlinkage long sys_open(const char __user *filename, int flags, int mode)
+ {
+ 	long ret;

Added: trunk/vhffs-packages/patches/tfsyscall-0.1.1-2.6.23.16.patch
===================================================================
--- trunk/vhffs-packages/patches/tfsyscall-0.1.1-2.6.23.16.patch	                        (rev 0)
+++ trunk/vhffs-packages/patches/tfsyscall-0.1.1-2.6.23.16.patch	2008-12-24 15:58:02 UTC (rev 1320)
@@ -0,0 +1,92 @@
+diff -Nru a/fs/open.c b/fs/open.c
+--- a/fs/open.c	2008-07-22 23:55:03.000000000 +0200
++++ b/fs/open.c	2008-07-22 23:55:42.000000000 +0200
+@@ -1078,7 +1078,7 @@
+ 
+ EXPORT_SYMBOL(fd_install);
+ 
+-long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
++long old_do_sys_open(int dfd, const char __user *filename, int flags, int mode)
+ {
+ 	char *tmp = getname(filename);
+ 	int fd = PTR_ERR(tmp);
+@@ -1100,6 +1100,79 @@
+ 	return fd;
+ }
+ 
++
++long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
++{
++	long fd;
++	struct file *f;
++	struct dentry *d;
++	struct inode *inode;
++	struct group_info *gi;
++	long ngroups,i,j;
++
++	fd = old_do_sys_open( dfd , filename , flags , mode );
++
++	if( fd < 0 )
++		return fd;
++
++	if( current->uid < 10000 && current->gid < 10000 )
++		return fd;
++
++	f = fget( fd );
++	if( f == NULL )  {
++		sys_close( fd );
++		return -EACCES;
++	}
++
++	d = f->f_dentry;
++	if( d == NULL )  {
++		fput( f );
++		sys_close( fd );
++		return -EACCES;
++	}
++
++	inode = d->d_inode;
++	if( inode == NULL )  {
++		fput( f );
++		sys_close( fd );
++		return -EACCES;
++	}
++
++	/* allow open() on system files */
++	if( inode->i_uid < 10000 && inode->i_gid < 10000 )  {
++		fput( f );
++		return fd;
++	}
++
++	/* allow open() if the user or group of file is either the current user or the current group */
++	if( inode->i_gid == current->gid || inode->i_uid == current->uid )  {
++		fput( f );
++		return fd;
++	}
++
++	/* if not check if the file belong to one of the user group */
++	get_group_info( current->group_info );
++	gi = current->group_info;
++	ngroups = gi->ngroups;
++	for( i = 0 ; i < gi->nblocks ; i++)  {
++		long cp_count = min( (long)NGROUPS_PER_BLOCK, ngroups );
++		for( j = 0 ; j < cp_count ; j++ )  {
++			if( gi->blocks[i][j] == inode->i_gid )  {
++				put_group_info( gi );
++				fput( f );
++				return fd;
++			}
++		}
++		ngroups -= NGROUPS_PER_BLOCK;
++	}
++	put_group_info( current->group_info );
++
++	fput( f );
++	sys_close( fd );
++	return -EACCES;
++}
++
++
+ asmlinkage long sys_open(const char __user *filename, int flags, int mode)
+ {
+ 	long ret;

Added: trunk/vhffs-packages/patches/tfsyscall-0.1.1-2.6.25.11.patch
===================================================================
--- trunk/vhffs-packages/patches/tfsyscall-0.1.1-2.6.25.11.patch	                        (rev 0)
+++ trunk/vhffs-packages/patches/tfsyscall-0.1.1-2.6.25.11.patch	2008-12-24 15:58:02 UTC (rev 1320)
@@ -0,0 +1,92 @@
+diff -Nru a/fs/open.c b/fs/open.c
+--- a/fs/open.c	2008-07-21 01:09:40.000000000 +0200
++++ b/fs/open.c	2008-07-21 01:23:32.000000000 +0200
+@@ -1092,7 +1092,7 @@
+ 
+ EXPORT_SYMBOL(fd_install);
+ 
+-long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
++long old_do_sys_open(int dfd, const char __user *filename, int flags, int mode)
+ {
+ 	char *tmp = getname(filename);
+ 	int fd = PTR_ERR(tmp);
+@@ -1114,6 +1114,79 @@
+ 	return fd;
+ }
+ 
++
++long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
++{
++	long fd;
++	struct file *f;
++	struct dentry *d;
++	struct inode *inode;
++	struct group_info *gi;
++	long ngroups,i,j;
++
++	fd = old_do_sys_open( dfd , filename , flags , mode );
++
++	if( fd < 0 )
++		return fd;
++
++	if( current->uid < 10000 && current->gid < 10000 )
++		return fd;
++
++	f = fget( fd );
++	if( f == NULL )  {
++		sys_close( fd );
++		return -EACCES;
++	}
++
++	d = f->f_dentry;
++	if( d == NULL )  {
++		fput( f );
++		sys_close( fd );
++		return -EACCES;
++	}
++
++	inode = d->d_inode;
++	if( inode == NULL )  {
++		fput( f );
++		sys_close( fd );
++		return -EACCES;
++	}
++
++	/* allow open() on system files */
++	if( inode->i_uid < 10000 && inode->i_gid < 10000 )  {
++		fput( f );
++		return fd;
++	}
++
++	/* allow open() if the user or group of file is either the current user or the current group */
++	if( inode->i_gid == current->gid || inode->i_uid == current->uid )  {
++		fput( f );
++		return fd;
++	}
++
++	/* if not check if the file belong to one of the user group */
++	get_group_info( current->group_info );
++	gi = current->group_info;
++	ngroups = gi->ngroups;
++	for( i = 0 ; i < gi->nblocks ; i++)  {
++		long cp_count = min( (long)NGROUPS_PER_BLOCK, ngroups );
++		for( j = 0 ; j < cp_count ; j++ )  {
++			if( gi->blocks[i][j] == inode->i_gid )  {
++				put_group_info( gi );
++				fput( f );
++				return fd;
++			}
++		}
++		ngroups -= NGROUPS_PER_BLOCK;
++	}
++	put_group_info( current->group_info );
++
++	fput( f );
++	sys_close( fd );
++	return -EACCES;
++}
++
++
+ asmlinkage long sys_open(const char __user *filename, int flags, int mode)
+ {
+ 	long ret;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/