[vhffs-dev] [753] vhffs-fs now check object state

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


Revision: 753
Author:   gradator
Date:     2007-08-02 20:39:23 +0000 (Thu, 02 Aug 2007)

Log Message:
-----------
vhffs-fs now check object state

Modified Paths:
--------------
    trunk/vhffs-fs/vhffsfs.c


Modified: trunk/vhffs-fs/vhffsfs.c
===================================================================
--- trunk/vhffs-fs/vhffsfs.c	2007-08-02 20:13:04 UTC (rev 752)
+++ trunk/vhffs-fs/vhffsfs.c	2007-08-02 20:39:23 UTC (rev 753)
@@ -320,7 +320,7 @@
 	PGresult *res;
 	char *homedir=NULL;
 
-	snprintf(query, 128, "SELECT homedir FROM vhffs_users WHERE uid = %d", fuse_get_context()->uid);
+	snprintf(query, 128, "SELECT u.homedir FROM vhffs_users u INNER JOIN vhffs_object o ON o.object_id=u.object_id WHERE o.state=6 AND u.uid = %d", fuse_get_context()->uid);
 	res=vhffsfs_PGQuery(query);
 	if(!res) return NULL;
 
@@ -344,7 +344,7 @@
 	for(cur = group ; *cur ; cur++)
  		if(! ( (*cur >= 'a' && *cur <= 'z') || (*cur >= '0' && *cur <= '9') ) ) return NULL;
 
-	snprintf(query, 256, "SELECT g.groupname FROM vhffs_groups g INNER JOIN vhffs_user_group ug ON ug.gid = g.gid WHERE ug.uid = %d AND g.groupname = '%s'", fuse_get_context()->uid, group);
+	snprintf(query, 256, "SELECT g.groupname FROM vhffs_groups g INNER JOIN vhffs_user_group ug ON ug.gid=g.gid INNER JOIN vhffs_object o ON o.object_id=g.object_id WHERE ug.uid = %d AND o.state=6 AND g.groupname='%s'", fuse_get_context()->uid, group);
 	res=vhffsfs_PGQuery(query);
 	if(!res) return NULL;
 
@@ -372,7 +372,7 @@
 	for(cur = group ; *cur ; cur++)
 		if(! ( (*cur >= 'a' && *cur <= 'z') || (*cur >= '0' && *cur <= '9') ) ) return 0;
 
-	snprintf(query, 256, "SELECT gid FROM vhffs_groups WHERE groupname = '%s'", group);
+	snprintf(query, 256, "SELECT g.gid FROM vhffs_groups g INNER JOIN vhffs_object o ON o.object_id=g.object_id WHERE o.state=6 AND g.groupname='%s' ", group);
 	res=vhffsfs_PGQuery(query);
 	if(!res) return 0;
 
@@ -400,7 +400,7 @@
 	for(cur = website ; *cur ; cur++)
  		if(! ( (*cur >= 'a' && *cur <= 'z') || (*cur >= '0' && *cur <= '9') || *cur == '-' || *cur == '.') ) return NULL;
 
-	snprintf(query, 256, "SELECT servername FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid WHERE g.groupname = '%s' AND servername = '%s'", group, website);
+	snprintf(query, 256, "SELECT servername FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id=h.object_id INNER JOIN vhffs_groups g ON g.gid=o.owner_gid WHERE o.state=6 AND g.groupname='%s' AND servername='%s'", group, website);
 	res=vhffsfs_PGQuery(query);
 	if(!res) return NULL;
 
@@ -439,7 +439,7 @@
 	for(cur = name ; *cur ; cur++)
  		if(! ( (*cur >= 'a' && *cur <= 'z') || (*cur >= '0' && *cur <= '9') ) ) return NULL;
 
-	snprintf(query, 256, "SELECT name FROM vhffs_repository r INNER JOIN vhffs_object o ON o.object_id = r.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid WHERE g.groupname = '%s' AND r.name = '%s'", group, name);
+	snprintf(query, 256, "SELECT name FROM vhffs_repository r INNER JOIN vhffs_object o ON o.object_id=r.object_id INNER JOIN vhffs_groups g ON g.gid=o.owner_gid WHERE o.state=6 AND g.groupname='%s' AND r.name='%s'", group, name);
 	res=vhffsfs_PGQuery(query);
 	if(!res) return NULL;
 
@@ -462,7 +462,7 @@
 	PGresult *res;
 	char **groups=NULL;
 
-	snprintf(query, 256, "SELECT g.groupname FROM vhffs_groups g INNER JOIN vhffs_user_group ug ON ug.gid = g.gid WHERE ug.uid = %d", uid);
+	snprintf(query, 256, "SELECT g.groupname FROM vhffs_groups g INNER JOIN vhffs_user_group ug ON ug.gid=g.gid INNER JOIN vhffs_object o ON o.object_id=g.object_id WHERE o.state=6 AND ug.uid=%d", uid);
 	res=vhffsfs_PGQuery(query);
 	if(!res) return NULL;
 
@@ -494,12 +494,12 @@
 	char **services=NULL;
 
 	// fetch websites
-	snprintf(query1, 256, "SELECT servername FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id WHERE o.owner_gid = %d", gid);
+	snprintf(query1, 256, "SELECT servername FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id=h.object_id WHERE o.state=6 AND o.owner_gid=%d", gid);
 	res1=vhffsfs_PGQuery(query1);
 	if(!res1) return NULL;
 
 	// fetch repositories
-	snprintf(query2, 256, "SELECT name FROM vhffs_repository r INNER JOIN vhffs_object o ON o.object_id = r.object_id WHERE o.owner_gid = %d", gid);
+	snprintf(query2, 256, "SELECT name FROM vhffs_repository r INNER JOIN vhffs_object o ON o.object_id=r.object_id WHERE o.state=6 AND o.owner_gid=%d", gid);
 	res2=vhffsfs_PGQuery(query2);
 	if(!res2) {
 		vhffsfs_PGClear(query1, res1);


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