diff -Nr -p2 ./postfix-2.3-20050623/src/global/Makefile.in .//postfix-2.3-20050623-my/src/global/Makefile.in *** ./postfix-2.3-20050623/src/global/Makefile.in Sat Jun 25 20:31:33 2005 --- ./postfix-2.3-20050623-my/src/global/Makefile.in Sat Jun 25 19:29:13 2005 *************** SRCS = abounce.c anvil_clnt.c been_here.c bounce.c bounce_log.c \ *** 5,7 **** deliver_completed.c deliver_flock.c deliver_pass.c deliver_request.c \ ! dict_ldap.c dict_mysql.c dict_pgsql.c dict_proxy.c domain_list.c \ dot_lockfile.c dot_lockfile_as.c ext_prop.c file_id.c flush_clnt.c \ --- 5,7 ---- deliver_completed.c deliver_flock.c deliver_pass.c deliver_request.c \ ! dict_ldap.c dict_argi.c dict_mysql.c dict_pgsql.c dict_proxy.c domain_list.c \ dot_lockfile.c dot_lockfile_as.c ext_prop.c file_id.c flush_clnt.c \ ***************OBJS = abounce.o anvil_clnt.o been_here.o bounce.o bounce_log.o \ *** 34,36 **** deliver_completed.o deliver_flock.o deliver_pass.o deliver_request.o \ ! dict_ldap.o dict_mysql.o dict_pgsql.o dict_proxy.o domain_list.o \ dot_lockfile.o dot_lockfile_as.o ext_prop.o file_id.o flush_clnt.o \ --- 34,36 ---- deliver_completed.o deliver_flock.o deliver_pass.o deliver_request.o \ ! dict_ldap.o dict_argi.o dict_mysql.o dict_pgsql.o dict_proxy.o domain_list.o \ dot_lockfile.o dot_lockfile_as.o ext_prop.o file_id.o flush_clnt.o \ *************** HDRS = abounce.h anvil_clnt.h been_here.h bounce.h bounce_log.h \ *** 62,66 **** debug_peer.h debug_process.h defer.h deliver_completed.h \ ! deliver_flock.h deliver_pass.h deliver_request.h dict_ldap.h \ dict_mysql.h dict_pgsql.h dict_proxy.h domain_list.h dot_lockfile.h \ dot_lockfile_as.h ext_prop.h file_id.h flush_clnt.h header_opts.h \ header_token.h hold_message.h input_transp.h is_header.h \ --- 62,66 ---- debug_peer.h debug_process.h defer.h deliver_completed.h \ ! deliver_flock.h deliver_pass.h deliver_request.h dict_ldap.h dict_argi.h\ dict_mysql.h dict_pgsql.h dict_proxy.h domain_list.h dot_lockfile.h \ dot_lockfile_as.h ext_prop.h file_id.h flush_clnt.h header_opts.h \ header_token.h hold_message.h input_transp.h is_header.h \ *************** dict_ldap.o: dict_ldap.c *** 667,670 **** --- 667,678 ---- dict_ldap.o: dict_ldap.h dict_ldap.o: string_list.h + dict_argi.o: dict_argi.c + dict_argi.o: ../../include/msg.h + dict_argi.o: ../../include/mymalloc.h + dict_argi.o: ../../include/dict.h + dict_argi.o: ../../include/vstream.h + dict_argi.o: ../../include/vbuf.h + dict_argi.o: ../../include/argv.h + dict_argi.o: dict_argi.h dict_mysql.o: ../../include/argv.h dict_mysql.o: ../../include/dict.h diff -Nr -p2 ./postfix-2.3-20050623/src/global/mail_dict.c ./postfix-2.3-20050623-my/src/global/mail_dict.c *** ./postfix-2.3-20050623/src/global/mail_dict.c Sat Jun 25 19:29:13 2005 --- ./postfix-2.3-20050623-my/src/global/mail_dict.c Sat Jun 25 19:29:13 2005 *************** *** 28,33 **** --- 28,34 ---- /* Utility library. */ #include #include + #include /* Global library. */ *************** *** 54,57 **** --- 54,60 ---- #ifdef HAS_PGSQL DICT_TYPE_PGSQL, dict_pgsql_open, + #endif + #ifdef HAS_ARGI + DICT_TYPE_ARGI, dict_argi_open, #endif diff -Nr -p2 ./postfix-2.3-20050623/src/global/dict_argi.c .//postfix-2.3-20050623-my/src/global/dict_argi.c *** ./postfix-2.3-20050623/src/global/dict_argi.c Sat Jun 25 20:31:33 2005 --- ./postfix-2.3-20050623-my/src/global/dict_argi.c Sat Jun 25 19:29:13 2005 *************** *** 0 **** --- 1,126 ---- + /*++ + /* NAME + /* dict_argi 3 + /* SUMMARY + /* dictionary manager interface to ARAGOI databases + /* SYNOPSIS + /* #include + /* + /* DICT *dict_argi_open(name, open_flags, dict_flags) + /* const char *name; + /* int open_flags; + /* int dict_flags; + /* DESCRIPTION + /* dict_argi_open() creates a dictionary of type 'argi'. This + /* dictionary is an interface for the postfix key->value mappings + /* to argi. The result is a pointer to the installed dictionary, + /* or a null pointer in case of problems. + /* + /* .IP open_flags + /* Must be O_RDONLY. + /* .IP dict_flags + /* See dict_open(3). + /* .PP + /* Configuration parameters: + /* + /* .PP + /* SEE ALSO + /* dict(3) generic dictionary manager + /* AUTHOR(S) + /* Hiroshi Katayama + /* Southern Pacific Computer Inc. + /* hiroshi@soupacific.com + /*--*/ + + /* System library. */ + #include "sys_defs.h" + + #ifdef HAS_ARGI + + /* Utility library. */ + + #include "dict.h" + #include "msg.h" + #include "mymalloc.h" + #include "argv.h" + #include "vstring.h" + #include "split_at.h" + #include + #include + + /* Global library. */ + + /* Application-specific. */ + + #include "dict_argi.h" + + /* need some structs to help organize things */ + + typedef struct { + DICT dict; + VSTRING *name; + } DICT_ARGI; + + // + /* internal function declarations */ + static const char *dict_argi_lookup(DICT *, const char *); + + DICT *dict_argi_open(const char *, int, int); + static void dict_argi_close(DICT *); + + static const char *dict_argi_lookup(DICT *dict, const char *name) + { + DICT_ARGI *dict_argi = (DICT_ARGI *)dict; + dict_errno = 0; + const char *r; + char comandbuf[256], str[1024],*ptr; + FILE *fp; + //format command string + sprintf(comandbuf, "aragoi.exe %s %s ", dict_argi->name, name); + + if((fp=popen(comandbuf,"r"))==NULL) + { + dict_errno = 1; + exit(-1); + } + while(1){ + fgets(str,512,fp); + if(feof(fp)){ + break; + } + ptr=strchr(str,'\n'); + if(ptr!=NULL) + { + *ptr='\0'; + } + } + pclose(fp); + r = str; + return ((dict_errno == 0 && *r) ? r : 0); + } + + /* dict_argi_open - open ARAGOI data base */ + + DICT *dict_argi_open(const char *name, int open_flags, int dict_flags) + { + DICT_ARGI *dict_argi; + // Sanity checks. + if (open_flags != O_RDONLY) + msg_fatal("%s:%s map requires O_RDONLY access mode", + name , DICT_TYPE_ARGI);////, name); + dict_argi = (DICT_ARGI *) dict_alloc(DICT_TYPE_ARGI, name, sizeof(DICT_ARGI)); + dict_argi->name = name; + dict_argi->dict.lookup = dict_argi_lookup; + dict_argi->dict.close = dict_argi_close; + + return (DICT_DEBUG (&dict_argi->dict)); + } + + /* dict_argi_close - close ARGI database */ + + static void dict_argi_close(DICT *dict) + { + dict_free(dict); + } + + #endif diff -Nr -p2 ./postfix-2.3-20050623/src/global/dict_argi.h .//postfix-2.3-20050623-my/src/global/dict_argi.h *** ./postfix-2.3-20050623/src/global/dict_argi.h Sat Jun 25 20:31:33 2005 --- ./postfix-2.3-20050623-my/src/global/dict_argi.h Sat Jun 25 19:29:13 2005 *************** *** 0 **** --- 1,36 ---- + #ifndef _DICT_ARGI_H_INCLUDED_ + #define _DICT_ARGI_H_INCLUDED_ + + /*++ + /* NAME + /* dict_argi 3h + /* SUMMARY + /* dictionary manager interface to aragoi databases + /* SYNOPSIS + /* #include + /* DESCRIPTION + /* .nf + + /* + * Utility library. + */ + #include + + /* + * External interface. + */ + #define DICT_TYPE_ARGI "argi" + + extern DICT *dict_argi_open(const char *, int, int);+ + + + /* LICENSE + /* .ad + /* .fi + /* The Secure Mailer license must be distributed with this software. + /* AUTHOR(S) + /* Hiroshi Katayama + /* Southern Pacific Computer Inc. + /* hiroshi@soupacific.com + /*--*/ + + #endif