View Single Post
Old 04-01-2006, 07:51 PM  
mr_F
Member
 
Join Date: Jul 2005
Posts: 33
Default

hey, i made something, hope it suites your needs, worked perfectly for me

here's the source code:
Code:
/*
	another fine script request by mr_F ;)  ----- April 1st, 2006
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <malloc.h>
#define MAX_GROUPLEN 256
#define MAX_PATH_SIZE 2000
#define DEBUG 0


int
main(int argc, char *argv[]) {

	char *dirname;
	char path[MAX_PATH_SIZE];
	char *cwd;
	char groups[MAX_GROUPLEN];
	FILE *groupfile=NULL;
	int i;
	int had_mask=0;


#if DEBUG
	dirname = "somedir-DAAN";
	groupfile = fopen("groups.txt","r");
	cwd = malloc(sizeof(char) * 100);
	strcpy(cwd,"/shit****er");
#else
	dirname = argv[2];
	cwd = getenv("virtualpath");
	groupfile = fopen("..\\scripts\\ioAG\\groups.txt","r");
#endif	
	
	if (groupfile==NULL || dirname==NULL)
	{
		printf("Error with script, cannot find/oepn groups.txt and/or cannot detect directory\nIgnoring script interception\n");
		printf("directory = %s\n",dirname);
		return 0;
	}

	for (i=0; !feof(groupfile); i++)
	{
		fscanf(groupfile,"%s\t%s",groups,path);

		if (strstr(cwd,path)!=NULL)
			had_mask=1;
		else
			continue;

		
			if (strstr(dirname,groups)!=NULL)
				return 0;
		
	}

	fclose(groupfile);

	if (had_mask==0)
		return 0;
	else {
		printf("550 Permission denied.  Releases from this group are not allowed.\n");
		return 1;
	}

};
get it here http://www.dvnswtzk.com/ioAG.php


--------- mr_F
mr_F is offline   Reply With Quote