diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-10-28 23:20:22 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-10-28 23:20:22 +0300 |
commit | 4a49f5341ae9005c9ffbd7620efaecffcdfda79f (patch) | |
tree | 53ba2d6a638bd9b83747ebd6899931ab89d13ca0 /libmailutils/server/acl.c | |
parent | 697384c64dadb0a4db97136a6cbcf2166c48897b (diff) | |
download | mailutils-4a49f5341ae9005c9ffbd7620efaecffcdfda79f.tar.gz mailutils-4a49f5341ae9005c9ffbd7620efaecffcdfda79f.tar.bz2 |
Add wordsplit module.
The wordsplit module (borrowed from another project of mine, called 'grecs')
provides a flexible and powerful mechanism for parsing input in a way
similar to posix-shell. In particular, the POSIX function wordexp is
a subset of the wordsplit functionality.
The argcv module is now deprecated.
* include/mailutils/wordsplit.h: New file.
* include/mailutils/Makefile.am (pkginclude_HEADERS): Add wordsplit.h
* libmailutils/string/wordsplit.c: New file.
* libmailutils/string/Makefile.am (libstring_la_SOURCES): Add wordsplit.c.
* include/mailutils/argcv.h (mu_argcv_join): New proto.
(mu_argcv_get, mu_argcv_get_n, mu_argcv_get_np)
(mu_argcv_unquote_char, mu_argcv_quote_char)
(mu_argcv_quoted_length, mu_argcv_unquote_copy)
(mu_argcv_quote_copy): Mark as deprecated.
* include/mailutils/mailutils.h: Include wordsplit.h.
* libmailutils/tests/wsp.c: New file.
* libmailutils/tests/.gitignore: List wsp.
* libmailutils/tests/wordsplit.at: New file.
* libmailutils/tests/Makefile.am (noinst_PROGRAMS): Add wsp
(TESTSUITE_AT): Add wordsplit.at.
* libmailutils/tests/argcv.c: Define MU_ARCGV_DEPRECATED to
avoid deprecation warnings.
* libmailutils/tests/testsuite.at: Include wordsplit.at.
* libmailutils/base/argcvfree.c: New file.
* libmailutils/base/argcvjoin.c: New file.
* libmailutils/base/argcvrem.c: New file.
* libmailutils/base/Makefile.am (libbase_la_SOURCES): Add new files.
* libmailutils/base/argcv.c: Define MU_ARCGV_DEPRECATED to
avoid deprecation warnings.
(argcv_string, argcv_free, argv_free)
(mu_argcv_remove): Rewrite in separate modules.
* comsat/comsat.h: Include wordsplit.h.
* imap4d/imap4d.h: Likewise.
* mail/mail.h: Likewise.
* mh/mh.h: Likewise.
* readmsg/readmsg.h: Likewise.
* comsat/action.c: Use wordsplit.
* imap4d/fetch.c: Likewise.
* lib/mailcap.c: Likewise.
* libmailutils/auth/mu_auth.c: Likewise.
* libmailutils/base/mutil.c: Likewise.
* libmailutils/cfg/format.c: Likewise.
* libmailutils/cfg/lexer.l: Likewise.
* libmailutils/cfg/parser.y: Likewise.
* libmailutils/diag/gdebug.c: Likewise.
* libmailutils/mailer/mailer.c: Likewise.
* libmailutils/server/acl.c: Likewise.
* libmailutils/stream/prog_stream.c: Likewise.
* libmailutils/tests/listop.c: Likewise.
* libmailutils/url/create.c: Likewise.
* libmu_auth/ldap.c: Likewise.
* libmu_auth/radius.c: Likewise.
* libmu_sieve/sieve.l: Likewise.
* libproto/mailer/mbox.c: Likewise.
* libproto/mailer/smtp.c: Likewise.
* libproto/mailer/smtp_gsasl.c: Likewise.
* mail/mailline.c: Likewise.
* mail/mailvar.c: Likewise.
* mail/send.c: Likewise.
* mail/util.c: Likewise.
* mh/folder.c: Likewise.
* mh/mh_alias.y: Likewise.
* mh/mh_argp.c: Likewise.
* mh/mh_init.c: Likewise.
* mh/mh_list.c: Likewise.
* mh/mh_msgset.c: Likewise.
* mh/mh_sequence.c: Likewise.
* mh/mh_whatnow.c: Likewise.
* mh/mh_sequence.c: Likewise.
* mh/mh_whatnow.c: Likewise.
* mh/mhn.c: Likewise.
* mh/send.c: Likewise.
* movemail/movemail.c: Likewise.
* mu/shell.c: Likewise.
* readmsg/readmsg.c: Likewise.
* testsuite/smtpsend.c: Likewise.
* pop3d/popauth.c: Use wordsplit.
Use simplified input format (username and password delimited
by any amount of whitespace).
Read/produce old format if invoked with the --compatibility option.
* examples/aclck.c: Use wordsplit instead of argcv.
* examples/header.c: Likewise.
* examples/mta.c: Likewise.
* examples/.gitignore: Remove pop3client.
* examples/Makefile.am: Remove pop3client.
* po/POTFILES.in: Add new files.
Diffstat (limited to 'libmailutils/server/acl.c')
-rw-r--r-- | libmailutils/server/acl.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/libmailutils/server/acl.c b/libmailutils/server/acl.c index a3e3764f2..d7a13629a 100644 --- a/libmailutils/server/acl.c +++ b/libmailutils/server/acl.c @@ -28,8 +28,9 @@ #include <unistd.h> #include <stdlib.h> #include <string.h> +#include <mailutils/nls.h> #include <mailutils/acl.h> -#include <mailutils/argcv.h> +#include <mailutils/wordsplit.h> #include <mailutils/list.h> #include <mailutils/debug.h> #include <mailutils/error.h> @@ -581,14 +582,19 @@ spawn_prog (const char *cmdline, int *pstatus, struct run_closure *rp) if (pid == 0) { int i; - int argc; - char **argv; + struct mu_wordsplit ws; - mu_argcv_get (s, " \t", NULL, &argc, &argv); + if (mu_wordsplit (s, &ws, MU_WRDSF_DEFFLAGS)) + { + mu_error (_("cannot split line `%s': %s"), s, + mu_wordsplit_strerror (&ws)); + _exit (127); + } + for (i = getmaxfd (); i > 2; i--) close (i); - execvp (argv[0], argv); - exit (127); + execvp (ws.ws_wordv[0], ws.ws_wordv); + _exit (127); } free (s); |