projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
and close iconv handle if encoded block empty
[mmh]
/
uip
/
msgchk.c
diff --git
a/uip/msgchk.c
b/uip/msgchk.c
index
a063049
..
69999f6
100644
(file)
--- a/
uip/msgchk.c
+++ b/
uip/msgchk.c
@@
-3,11
+3,15
@@
* msgchk.c -- check for mail
*
* $Id$
* msgchk.c -- check for mail
*
* $Id$
+ *
+ * This code is Copyright (c) 2002, by the authors of nmh. See the
+ * COPYRIGHT file in the root directory of the nmh distribution for
+ * complete copyright information.
*/
#include <h/mh.h>
*/
#include <h/mh.h>
-#include <zotnet/mts/mts.h>
-#include <zotnet/tws/tws.h>
+#include <h/mts.h>
+#include <h/tws.h>
#include <pwd.h>
#ifdef POP
#include <pwd.h>
#ifdef POP
@@
-36,6
+40,18
@@
# define APOPminc(a) 0
#endif
# define APOPminc(a) 0
#endif
+#ifndef KPOP
+# define KPOPminc(a) (a)
+#else
+# define KPOPminc(a) 0
+#endif
+
+#ifndef CYRUS_SASL
+# define SASLminc(a) (a)
+#else
+# define SASLminc(a) 0
+#endif
+
static struct swit switches[] = {
#define DATESW 0
{ "date", 0 },
static struct swit switches[] = {
#define DATESW 0
{ "date", 0 },
@@
-60,9
+76,17
@@
static struct swit switches[] = {
#define VERSIONSW 10
{ "version", 0 },
#define HELPSW 11
#define VERSIONSW 10
{ "version", 0 },
#define HELPSW 11
- { "help", 4 },
+ { "help", 0 },
#define SNOOPSW 12
{ "snoop", -5 },
#define SNOOPSW 12
{ "snoop", -5 },
+#define KPOPSW 13
+ { "kpop", KPOPminc (-4) },
+#define SASLSW 14
+ { "sasl", SASLminc(-4) },
+#define SASLMECHSW 15
+ { "saslmech", SASLminc(-5) },
+#define PROXYSW 16
+ { "proxy command", POPminc(-5) },
{ NULL, 0 }
};
{ NULL, 0 }
};
@@
-93,7
+117,7
@@
static int donote (char *, int);
static int checkmail (char *, char *, int, int, int);
#ifdef POP
static int checkmail (char *, char *, int, int, int);
#ifdef POP
-static int remotemail (char *, char *, int, int, int, int);
+static int remotemail (char *, char *, char *, int, int, int, int, int, int, char *);
#endif
#endif
@@
-102,9
+126,11
@@
main (int argc, char **argv)
{
int datesw = 1, notifysw = NT_ALL;
int rpop, status = 0;
{
int datesw = 1, notifysw = NT_ALL;
int rpop, status = 0;
+ int kpop = 0, sasl = 0;
int snoop = 0, vecp = 0;
uid_t uid;
int snoop = 0, vecp = 0;
uid_t uid;
- char *cp, *host = NULL, *user, buf[BUFSIZ];
+ char *cp, *host = NULL, *user, *proxy = NULL;
+ char buf[BUFSIZ], *saslmech = NULL;
char **argp, **arguments, *vec[MAXVEC];
struct passwd *pw;
char **argp, **arguments, *vec[MAXVEC];
struct passwd *pw;
@@
-133,11
+159,7
@@
main (int argc, char **argv)
snoop++;
#endif
snoop++;
#endif
-#ifdef KPOP
- rpop = 1;
-#else
rpop = 0;
rpop = 0;
-#endif
while ((cp = *argp++)) {
if (*cp == '-') {
while ((cp = *argp++)) {
if (*cp == '-') {
@@
-202,9
+224,27
@@
main (int argc, char **argv)
rpop = 0;
continue;
rpop = 0;
continue;
+ case KPOPSW:
+ kpop = 1;
+ continue;
+
case SNOOPSW:
snoop++;
continue;
case SNOOPSW:
snoop++;
continue;
+
+ case SASLSW:
+ sasl++;
+ continue;
+
+ case SASLMECHSW:
+ if (!(saslmech = *argp++) || *saslmech == '-')
+ adios (NULL, "missing argument to %s", argp[-2]);
+ continue;
+
+ case PROXYSW:
+ if (!(proxy = *argp++) || *proxy == '-')
+ adios (NULL, "missing argument to %s", argp[-2]);
+ continue;
}
}
if (vecp >= MAXVEC-1)
}
}
if (vecp >= MAXVEC-1)
@@
-250,11
+290,16
@@
main (int argc, char **argv)
#ifdef POP
if (host) {
#ifdef POP
if (host) {
+ if ( strcmp( POPSERVICE, "kpop" ) == 0 ) {
+ kpop = 1;
+ }
if (vecp == 0) {
if (vecp == 0) {
- status = remotemail (host, user, rpop, notifysw, 1, snoop);
+ status = remotemail (host, user, proxy, rpop, kpop, notifysw, 1,
+ snoop, sasl, saslmech);
} else {
for (vecp = 0; vec[vecp]; vecp++)
} else {
for (vecp = 0; vec[vecp]; vecp++)
- status += remotemail (host, vec[vecp], rpop, notifysw, 0, snoop);
+ status += remotemail (host, vec[vecp], proxy, rpop, kpop,
+ notifysw, 0, snoop, sasl, saslmech);
}
} else {
#endif /* POP */
}
} else {
#endif /* POP */
@@
-375,20
+420,21
@@
checkmail (char *user, char *home, int datesw, int notifysw, int personal)
extern char response[];
static int
extern char response[];
static int
-remotemail (char *host, char *user, int rpop, int notifysw, int personal, int snoop)
+remotemail (char *host, char *user, char *proxy, int rpop, int kpop, int notifysw, int personal, int snoop, int sasl, char *saslmech)
{
int nmsgs, nbytes, status;
char *pass = NULL;
if (user == NULL)
user = getusername ();
{
int nmsgs, nbytes, status;
char *pass = NULL;
if (user == NULL)
user = getusername ();
- if (rpop > 0)
+ if (kpop || sasl || (rpop > 0))
pass = getusername ();
else
ruserpass (host, &user, &pass);
/* open the POP connection */
pass = getusername ();
else
ruserpass (host, &user, &pass);
/* open the POP connection */
- if (pop_init (host, user, pass, snoop, rpop) == NOTOK
+ if (pop_init (host, user, pass, proxy, snoop, kpop ? 1 : rpop, kpop,
+ sasl, saslmech) == NOTOK
|| pop_stat (&nmsgs, &nbytes) == NOTOK /* check for messages */
|| pop_quit () == NOTOK) { /* quit POP connection */
advise (NULL, "%s", response);
|| pop_stat (&nmsgs, &nbytes) == NOTOK /* check for messages */
|| pop_quit () == NOTOK) { /* quit POP connection */
advise (NULL, "%s", response);