wmbiff: stop hiding pointers behind typedefs.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
This commit is contained in:
parent
dc66a3de45
commit
b055b12fa5
|
@ -11,6 +11,7 @@
|
|||
|
||||
#ifndef CLIENT
|
||||
#define CLIENT
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
@ -34,8 +35,8 @@ typedef unsigned int off_t;
|
|||
#define BUF_SIZE 1024
|
||||
|
||||
struct msglst;
|
||||
typedef struct _mbox_t *Pop3;
|
||||
typedef struct _mbox_t {
|
||||
|
||||
typedef struct Pop3_ {
|
||||
char label[BUF_SMALL]; /* Printed at left; max 5 chars */
|
||||
char path[BUF_BIG]; /* Path to mailbox */
|
||||
char notify[BUF_BIG]; /* Program to notify mail arrivation */
|
||||
|
@ -92,12 +93,12 @@ typedef struct _mbox_t {
|
|||
} pop_imap;
|
||||
} u;
|
||||
|
||||
int (*checkMail) ( /*@notnull@ */ Pop3);
|
||||
int (*checkMail) ( /*@notnull@ */ struct Pop3_ *);
|
||||
|
||||
/* collect the headers to show in a pop up */
|
||||
struct msglst *(*getHeaders) ( /*@notnull@ */ Pop3);
|
||||
struct msglst *(*getHeaders) ( /*@notnull@ */ struct Pop3_ *);
|
||||
/* allow the client to free the headers, or keep them cached */
|
||||
void (*releaseHeaders) ( /*@notnull@ */ Pop3, struct msglst * ml);
|
||||
void (*releaseHeaders) ( /*@notnull@ */ struct Pop3_ *, struct msglst * ml);
|
||||
|
||||
time_t prevtime;
|
||||
time_t prevfetch_time;
|
||||
|
@ -105,24 +106,24 @@ typedef struct _mbox_t {
|
|||
|
||||
/* command to execute to get a password, if needed */
|
||||
const char *askpass;
|
||||
} mbox_t;
|
||||
} Pop3;
|
||||
|
||||
/* creation calls must have this prototype */
|
||||
int pop3Create( /*@notnull@ */ Pop3 pc, const char *str);
|
||||
int imap4Create( /*@notnull@ */ Pop3 pc, const char *str);
|
||||
int shellCreate( /*@notnull@ */ Pop3 pc, const char *str);
|
||||
int mboxCreate( /*@notnull@ */ Pop3 pc, const char *str);
|
||||
int maildirCreate( /*@notnull@ */ Pop3 pc, const char *str);
|
||||
int pop3Create( /*@notnull@ */ Pop3 *pc, const char *str);
|
||||
int imap4Create( /*@notnull@ */ Pop3 *pc, const char *str);
|
||||
int shellCreate( /*@notnull@ */ Pop3 *pc, const char *str);
|
||||
int mboxCreate( /*@notnull@ */ Pop3 *pc, const char *str);
|
||||
int maildirCreate( /*@notnull@ */ Pop3 *pc, const char *str);
|
||||
|
||||
int sock_connect(const char *hostname, uint16_t port);
|
||||
FILE *openMailbox(Pop3 pc, const char *mbox_filename);
|
||||
FILE *openMailbox(Pop3 *pc, const char *mbox_filename);
|
||||
|
||||
/* backtickExpand returns null on failure */
|
||||
/*@null@ */
|
||||
char *backtickExpand(Pop3 pc, const char *path);
|
||||
char *backtickExpand(Pop3 *pc, const char *path);
|
||||
int fileHasChanged(const char *mbox_filename, time_t * atime,
|
||||
time_t * mtime, off_t * size);
|
||||
int grabCommandOutput(Pop3 pc, const char *command,
|
||||
int grabCommandOutput(Pop3 *pc, const char *command,
|
||||
/*@out@ */ char **output,
|
||||
/*@out@ *//*@null@ */ char **details);
|
||||
int exists(const char *filename); /* test -f */
|
||||
|
|
|
@ -55,16 +55,16 @@ static struct fdmap_struct {
|
|||
/*@owned@ */ struct connection_state *cs;
|
||||
} fdmap[FDMAP_SIZE];
|
||||
|
||||
static void ask_user_for_password( /*@notnull@ */ Pop3 pc,
|
||||
static void ask_user_for_password( /*@notnull@ */ Pop3 *pc,
|
||||
int bFlushCache);
|
||||
|
||||
/* authentication callbacks */
|
||||
#ifdef HAVE_GCRYPT_H
|
||||
static int authenticate_md5( /*@notnull@ */ Pop3 pc,
|
||||
static int authenticate_md5( /*@notnull@ */ Pop3 *pc,
|
||||
struct connection_state *scs,
|
||||
const char *capabilities);
|
||||
#endif
|
||||
static int authenticate_plaintext( /*@notnull@ */ Pop3 pc,
|
||||
static int authenticate_plaintext( /*@notnull@ */ Pop3 *pc,
|
||||
struct connection_state *scs,
|
||||
const char *capabilities);
|
||||
|
||||
|
@ -73,9 +73,9 @@ static int authenticate_plaintext( /*@notnull@ */ Pop3 pc,
|
|||
static struct imap_authentication_method {
|
||||
const char *name;
|
||||
/* callback returns 1 if successful, 0 if failed */
|
||||
int (*auth_callback) ( /*@notnull@ */ Pop3 pc,
|
||||
struct connection_state * scs,
|
||||
const char *capabilities);
|
||||
int (*auth_callback) ( /*@notnull@ */ Pop3 *pc,
|
||||
struct connection_state * scs,
|
||||
const char *capabilities);
|
||||
} auth_methods[] = {
|
||||
{
|
||||
#ifdef HAVE_GCRYPT_H
|
||||
|
@ -89,7 +89,7 @@ static struct imap_authentication_method {
|
|||
/* recover a socket from the connection cache */
|
||||
/*@null@*/
|
||||
/*@dependent@*/
|
||||
static struct connection_state *state_for_pcu(Pop3 pc)
|
||||
static struct connection_state *state_for_pcu(Pop3 *pc)
|
||||
{
|
||||
char *connection_id;
|
||||
struct connection_state *retval = NULL;
|
||||
|
@ -108,7 +108,7 @@ static struct connection_state *state_for_pcu(Pop3 pc)
|
|||
}
|
||||
|
||||
/* bind to the connection cache */
|
||||
static void bind_state_to_pcu(Pop3 pc,
|
||||
static void bind_state_to_pcu(Pop3 *pc,
|
||||
/*@owned@ */ struct connection_state *scs)
|
||||
{
|
||||
char *connection_id;
|
||||
|
@ -156,7 +156,7 @@ struct connection_state *unbind(
|
|||
/* creates a connection to the server, if a matching one doesn't exist. */
|
||||
/* *always* returns null, just declared this wasy to match other protocols. */
|
||||
/*@null@*/
|
||||
FILE *imap_open(Pop3 pc)
|
||||
FILE *imap_open(Pop3 *pc)
|
||||
{
|
||||
static int complained_already; /* we have to succeed once before
|
||||
complaining again about failure */
|
||||
|
@ -287,9 +287,9 @@ FILE *imap_open(Pop3 pc)
|
|||
|
||||
}
|
||||
|
||||
void imap_cacheHeaders( /*@notnull@ */ Pop3 pc);
|
||||
void imap_cacheHeaders( /*@notnull@ */ Pop3 *pc);
|
||||
|
||||
int imap_checkmail( /*@notnull@ */ Pop3 pc)
|
||||
int imap_checkmail( /*@notnull@ */ Pop3 *pc)
|
||||
{
|
||||
/* recover connection state from the cache */
|
||||
struct connection_state *scs = state_for_pcu(pc);
|
||||
|
@ -358,7 +358,7 @@ int imap_checkmail( /*@notnull@ */ Pop3 pc)
|
|||
}
|
||||
|
||||
void
|
||||
imap_releaseHeaders(Pop3 pc __attribute__ ((unused)), struct msglst *h)
|
||||
imap_releaseHeaders(Pop3 *pc __attribute__((unused)), struct msglst *h)
|
||||
{
|
||||
assert(h != NULL);
|
||||
/* allow the list to be released next time around */
|
||||
|
@ -374,7 +374,7 @@ imap_releaseHeaders(Pop3 pc __attribute__ ((unused)), struct msglst *h)
|
|||
}
|
||||
}
|
||||
|
||||
void imap_cacheHeaders( /*@notnull@ */ Pop3 pc)
|
||||
void imap_cacheHeaders( /*@notnull@ */ Pop3 *pc)
|
||||
{
|
||||
struct connection_state *scs = state_for_pcu(pc);
|
||||
char *msgid;
|
||||
|
@ -479,7 +479,7 @@ void imap_cacheHeaders( /*@notnull@ */ Pop3 pc)
|
|||
|
||||
/* a client is asking for the headers, hand em a reference, increase the
|
||||
one-bit reference counter */
|
||||
struct msglst *imap_getHeaders( /*@notnull@ */ Pop3 pc)
|
||||
struct msglst *imap_getHeaders( /*@notnull@ */ Pop3 *pc)
|
||||
{
|
||||
if (pc->headerCache == NULL)
|
||||
imap_cacheHeaders(pc);
|
||||
|
@ -489,7 +489,7 @@ struct msglst *imap_getHeaders( /*@notnull@ */ Pop3 pc)
|
|||
}
|
||||
|
||||
/* parse the config line to setup the Pop3 structure */
|
||||
int imap4Create( /*@notnull@ */ Pop3 pc, const char *const str)
|
||||
int imap4Create( /*@notnull@ */ Pop3 *pc, const char *const str)
|
||||
{
|
||||
int i;
|
||||
int matchedchars;
|
||||
|
@ -603,7 +603,7 @@ int imap4Create( /*@notnull@ */ Pop3 pc, const char *const str)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int authenticate_plaintext( /*@notnull@ */ Pop3 pc,
|
||||
static int authenticate_plaintext( /*@notnull@ */ Pop3 *pc,
|
||||
struct connection_state *scs,
|
||||
const char *capabilities)
|
||||
{
|
||||
|
@ -652,7 +652,7 @@ static int authenticate_plaintext( /*@notnull@ */ Pop3 pc,
|
|||
|
||||
#ifdef HAVE_GCRYPT_H
|
||||
static int
|
||||
authenticate_md5(Pop3 pc,
|
||||
authenticate_md5(Pop3 *pc,
|
||||
struct connection_state *scs, const char *capabilities)
|
||||
{
|
||||
char buf[BUF_SIZE];
|
||||
|
@ -715,7 +715,7 @@ authenticate_md5(Pop3 pc,
|
|||
}
|
||||
#endif
|
||||
|
||||
static void ask_user_for_password( /*@notnull@ */ Pop3 pc, int bFlushCache)
|
||||
static void ask_user_for_password( /*@notnull@ */ Pop3 *pc, int bFlushCache)
|
||||
{
|
||||
/* see if we already have a password, as provided in the config file, or
|
||||
already requested from the user. */
|
||||
|
|
|
@ -32,7 +32,7 @@ static int fontHeight;
|
|||
extern const char *foreground;
|
||||
extern const char *background;
|
||||
|
||||
Pop3 Active_pc;
|
||||
Pop3 *Active_pc;
|
||||
|
||||
static int loadFont(const char *fontname)
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ static int flush_expose(Window w)
|
|||
}
|
||||
|
||||
struct msglst *Headers;
|
||||
void msglst_show(Pop3 pc, int x, int y)
|
||||
void msglst_show(Pop3 *pc, int x, int y)
|
||||
{
|
||||
int maxfrm = 0;
|
||||
int maxsubj = 0;
|
||||
|
|
|
@ -8,6 +8,6 @@ struct msglst {
|
|||
unsigned int in_use:1;
|
||||
};
|
||||
|
||||
void msglst_show(Pop3 pc, int x, int y);
|
||||
void msglst_show(Pop3 *pc, int x, int y);
|
||||
void msglst_hide(void);
|
||||
void msglst_redraw(void);
|
||||
|
|
|
@ -28,33 +28,37 @@
|
|||
|
||||
extern int Relax;
|
||||
/* temp */
|
||||
static void ask_user_for_password( /*@notnull@ */ Pop3 pc, int bFlushCache);
|
||||
static void ask_user_for_password( /*@notnull@ */ Pop3 *pc, int bFlushCache);
|
||||
|
||||
#define PCU (pc->u).pop_imap
|
||||
#define POP_DM(pc, lvl, args...) DM(pc, lvl, "pop3: " args)
|
||||
|
||||
#ifdef HAVE_GCRYPT_H
|
||||
static struct connection_state *authenticate_md5( /*@notnull@ */ Pop3 pc, struct connection_state * scs,
|
||||
char *unused);
|
||||
static struct connection_state *authenticate_apop( /*@notnull@ */ Pop3 pc, struct connection_state * scs,
|
||||
char *apop_str);
|
||||
static struct connection_state *authenticate_md5( /*@notnull@ */ Pop3 *pc,
|
||||
struct connection_state *scs,
|
||||
char *unused);
|
||||
static struct connection_state *authenticate_apop( /*@notnull@ */ Pop3 *pc,
|
||||
struct connection_state *scs,
|
||||
char *apop_str);
|
||||
#endif
|
||||
static struct connection_state *authenticate_plaintext( /*@notnull@ */ Pop3 pc, struct connection_state * scs,
|
||||
char *unused);
|
||||
static struct connection_state *authenticate_plaintext( /*@notnull@ */ Pop3 *pc,
|
||||
struct connection_state *scs,
|
||||
char *unused);
|
||||
|
||||
void pop3_cacheHeaders( /*@notnull@ */ Pop3 pc);
|
||||
void pop3_cacheHeaders( /*@notnull@ */ Pop3 *pc);
|
||||
|
||||
extern void imap_releaseHeaders(Pop3 pc
|
||||
__attribute__ ((unused)),
|
||||
extern void imap_releaseHeaders(Pop3 *pc __attribute__((unused)),
|
||||
struct msglst *h);
|
||||
|
||||
extern struct connection_state *state_for_pcu(Pop3 pc);
|
||||
extern struct connection_state *state_for_pcu(Pop3 *pc);
|
||||
|
||||
static struct authentication_method {
|
||||
const char *name;
|
||||
/* callback returns the connection state pointer if successful,
|
||||
NULL if failed */
|
||||
struct connection_state *(*auth_callback) (Pop3 pc, struct connection_state * scs, char *apop_str);
|
||||
struct connection_state *(*auth_callback) (Pop3 *pc,
|
||||
struct connection_state *scs,
|
||||
char *apop_str);
|
||||
} auth_methods[] = {
|
||||
{
|
||||
#ifdef HAVE_GCRYPT_H
|
||||
|
@ -66,7 +70,7 @@ static struct authentication_method {
|
|||
};
|
||||
|
||||
/*@null@*/
|
||||
struct connection_state *pop3Login(Pop3 pc)
|
||||
struct connection_state *pop3Login(Pop3 *pc)
|
||||
{
|
||||
int fd;
|
||||
char buf[BUF_SIZE];
|
||||
|
@ -134,7 +138,7 @@ struct connection_state *pop3Login(Pop3 pc)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int pop3CheckMail( /*@notnull@ */ Pop3 pc)
|
||||
int pop3CheckMail( /*@notnull@ */ Pop3 *pc)
|
||||
{
|
||||
struct connection_state *scs;
|
||||
int read;
|
||||
|
@ -182,7 +186,7 @@ int pop3CheckMail( /*@notnull@ */ Pop3 pc)
|
|||
}
|
||||
|
||||
|
||||
struct msglst *pop_getHeaders( /*@notnull@ */ Pop3 pc)
|
||||
struct msglst *pop_getHeaders( /*@notnull@ */ Pop3 *pc)
|
||||
{
|
||||
if (pc->headerCache == NULL)
|
||||
pop3_cacheHeaders(pc);
|
||||
|
@ -193,7 +197,7 @@ struct msglst *pop_getHeaders( /*@notnull@ */ Pop3 pc)
|
|||
|
||||
|
||||
|
||||
int pop3Create(Pop3 pc, const char *str)
|
||||
int pop3Create(Pop3 *pc, const char *str)
|
||||
{
|
||||
/* POP3 format: pop3:user:password@server[:port] */
|
||||
/* new POP3 format: pop3:user password server [port] */
|
||||
|
@ -291,8 +295,9 @@ int pop3Create(Pop3 pc, const char *str)
|
|||
|
||||
|
||||
#ifdef HAVE_GCRYPT_H
|
||||
static struct connection_state *authenticate_md5(Pop3 pc, struct connection_state * scs, char *apop_str
|
||||
__attribute__ ((unused)))
|
||||
static struct connection_state *authenticate_md5(Pop3 *pc,
|
||||
struct connection_state *scs,
|
||||
char *apop_str __attribute__((unused)))
|
||||
{
|
||||
char buf[BUF_SIZE];
|
||||
char buf2[BUF_SIZE];
|
||||
|
@ -349,7 +354,9 @@ static struct connection_state *authenticate_md5(Pop3 pc, struct connection_stat
|
|||
}
|
||||
}
|
||||
|
||||
static struct connection_state *authenticate_apop(Pop3 pc, struct connection_state * scs, char *apop_str)
|
||||
static struct connection_state *authenticate_apop(Pop3 *pc,
|
||||
struct connection_state *scs,
|
||||
char *apop_str)
|
||||
{
|
||||
gcry_md_hd_t gmh;
|
||||
gcry_error_t rc;
|
||||
|
@ -392,9 +399,9 @@ static struct connection_state *authenticate_apop(Pop3 pc, struct connection_sta
|
|||
#endif /* HAVE_GCRYPT_H */
|
||||
|
||||
/*@null@*/
|
||||
static struct connection_state *authenticate_plaintext( /*@notnull@ */ Pop3 pc,
|
||||
struct connection_state * scs, char *apop_str
|
||||
__attribute__ ((unused)))
|
||||
static struct connection_state *authenticate_plaintext( /*@notnull@ */ Pop3 *pc,
|
||||
struct connection_state *scs,
|
||||
char *apop_str __attribute__((unused)))
|
||||
{
|
||||
char buf[BUF_SIZE];
|
||||
|
||||
|
@ -448,7 +455,7 @@ static struct connection_state *authenticate_plaintext( /*@notnull@ */ Pop3 pc,
|
|||
return scs;
|
||||
}
|
||||
|
||||
void pop3_cacheHeaders( /*@notnull@ */ Pop3 pc)
|
||||
void pop3_cacheHeaders( /*@notnull@ */ Pop3 *pc)
|
||||
{
|
||||
char buf[BUF_SIZE];
|
||||
struct connection_state *scs;
|
||||
|
@ -502,7 +509,7 @@ void pop3_cacheHeaders( /*@notnull@ */ Pop3 pc)
|
|||
}
|
||||
|
||||
/* vim:set ts=4: */
|
||||
static void ask_user_for_password( /*@notnull@ */ Pop3 pc, int bFlushCache)
|
||||
static void ask_user_for_password( /*@notnull@ */ Pop3 *pc, int bFlushCache)
|
||||
{
|
||||
/* see if we already have a password, as provided in the config file, or
|
||||
already requested from the user. */
|
||||
|
|
|
@ -63,7 +63,7 @@ FILE *kind_popen(const char *command, const char *type)
|
|||
/* returns as a mailcheck function does: -1 on fail, 0 on success */
|
||||
static int kind_pclose( /*@only@ */ FILE * F,
|
||||
const char *command,
|
||||
/*@null@ */ Pop3 pc)
|
||||
/*@null@ */ Pop3 *pc)
|
||||
{
|
||||
int exit_status = pclose(F);
|
||||
|
||||
|
@ -87,7 +87,7 @@ static int kind_pclose( /*@only@ */ FILE * F,
|
|||
return (exit_status);
|
||||
}
|
||||
|
||||
int grabCommandOutput(Pop3 pc, const char *command, /*@out@ */
|
||||
int grabCommandOutput(Pop3 *pc, const char *command, /*@out@ */
|
||||
char **output, /*@out@ *//*@null@ */ char **details)
|
||||
{
|
||||
FILE *F;
|
||||
|
@ -121,7 +121,7 @@ int grabCommandOutput(Pop3 pc, const char *command, /*@out@ */
|
|||
|
||||
/* returns null on failure */
|
||||
/*@null@*/
|
||||
char *backtickExpand(Pop3 pc, const char *path)
|
||||
char *backtickExpand(Pop3 *pc, const char *path)
|
||||
{
|
||||
char bigbuffer[1024];
|
||||
const char *tickstart;
|
||||
|
@ -152,7 +152,7 @@ char *backtickExpand(Pop3 pc, const char *path)
|
|||
return (strdup_ordie(bigbuffer));
|
||||
}
|
||||
|
||||
int shellCmdCheck(Pop3 pc)
|
||||
int shellCmdCheck(Pop3 *pc)
|
||||
{
|
||||
int count_status = 0;
|
||||
char *commandOutput;
|
||||
|
@ -220,7 +220,7 @@ int shellCmdCheck(Pop3 pc)
|
|||
return (0);
|
||||
}
|
||||
|
||||
struct msglst *shell_getHeaders( /*@notnull@ */ Pop3 pc)
|
||||
struct msglst *shell_getHeaders( /*@notnull@ */ Pop3 *pc)
|
||||
{
|
||||
struct msglst *message_list = NULL;
|
||||
|
||||
|
@ -247,7 +247,7 @@ struct msglst *shell_getHeaders( /*@notnull@ */ Pop3 pc)
|
|||
}
|
||||
|
||||
void
|
||||
shell_releaseHeaders(Pop3 pc __attribute__ ((unused)), struct msglst *h)
|
||||
shell_releaseHeaders(Pop3 *pc __attribute__((unused)), struct msglst *h)
|
||||
{
|
||||
for (; h != NULL;) {
|
||||
struct msglst *n = h->next;
|
||||
|
@ -256,7 +256,7 @@ shell_releaseHeaders(Pop3 pc __attribute__ ((unused)), struct msglst *h)
|
|||
}
|
||||
}
|
||||
|
||||
int shellCreate( /*@notnull@ */ Pop3 pc, const char *str)
|
||||
int shellCreate( /*@notnull@ */ Pop3 *pc, const char *str)
|
||||
{
|
||||
/* SHELL format: shell:::/path/to/script */
|
||||
const char *reserved1, *reserved2, *commandline;
|
||||
|
|
|
@ -50,7 +50,7 @@ static int count_msgs(char *path)
|
|||
return count;
|
||||
}
|
||||
|
||||
int maildirCheckHistory(Pop3 pc)
|
||||
int maildirCheckHistory(Pop3 *pc)
|
||||
{
|
||||
struct stat st_new;
|
||||
struct stat st_cur;
|
||||
|
@ -137,7 +137,7 @@ int maildirCheckHistory(Pop3 pc)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int maildirCreate(Pop3 pc, const char *str)
|
||||
int maildirCreate(Pop3 *pc, const char *str)
|
||||
{
|
||||
int i;
|
||||
char c;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#define FROM_STR "From "
|
||||
#define STATUS_STR "Status: "
|
||||
|
||||
FILE *openMailbox(Pop3 pc, const char *mbox_filename)
|
||||
FILE *openMailbox(Pop3 *pc, const char *mbox_filename)
|
||||
{
|
||||
FILE *mailbox;
|
||||
|
||||
|
@ -40,7 +40,7 @@ FILE *openMailbox(Pop3 pc, const char *mbox_filename)
|
|||
}
|
||||
|
||||
/* count the messages in a mailbox */
|
||||
static void countMessages(Pop3 pc, const char *mbox_filename)
|
||||
static void countMessages(Pop3 *pc, const char *mbox_filename)
|
||||
{
|
||||
FILE *F;
|
||||
char buf[BUF_SIZE];
|
||||
|
@ -126,7 +126,7 @@ fileHasChanged(const char *mbox_filename, time_t * atime,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int mboxCheckHistory(Pop3 pc)
|
||||
int mboxCheckHistory(Pop3 *pc)
|
||||
{
|
||||
char *mbox_filename = backtickExpand(pc, pc->path);
|
||||
struct utimbuf ut;
|
||||
|
@ -147,7 +147,7 @@ int mboxCheckHistory(Pop3 pc)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int mboxCreate(Pop3 pc, const char *str)
|
||||
int mboxCreate(Pop3 *pc, const char *str)
|
||||
{
|
||||
/* MBOX format: mbox:fullpathname */
|
||||
|
||||
|
|
|
@ -46,22 +46,22 @@
|
|||
#define ENFROB(x)
|
||||
#endif
|
||||
|
||||
typedef struct password_binding_struct {
|
||||
struct password_binding_struct *next;
|
||||
typedef struct password_binding_ {
|
||||
struct password_binding_ *next;
|
||||
char user[BUF_SMALL];
|
||||
char server[BUF_BIG];
|
||||
char password[BUF_SMALL]; /* may be frobnicated */
|
||||
size_t password_len; /* frobnicated *'s are nulls */
|
||||
} *password_binding;
|
||||
size_t password_len; /* frobnicated *'s are nulls */
|
||||
} password_binding;
|
||||
|
||||
static password_binding pass_list = NULL;
|
||||
static password_binding *pass_list;
|
||||
|
||||
/* verifies that askpass_fname, if it has no spaces, exists as
|
||||
a file, is owned by the user or by root, and is not world
|
||||
writeable. This is just a sanity check, and is not intended
|
||||
to ensure the integrity of the password-asking program. */
|
||||
/* would be static, but used in test_wmbiff */
|
||||
int permissions_ok(Pop3 pc, const char *askpass_fname)
|
||||
int permissions_ok(Pop3 *pc, const char *askpass_fname)
|
||||
{
|
||||
struct stat st;
|
||||
if (index(askpass_fname, ' ')) {
|
||||
|
@ -110,7 +110,7 @@ int permissions_ok(Pop3 pc, const char *askpass_fname)
|
|||
#include<Security/Security.h>
|
||||
|
||||
static void
|
||||
get_password_from_keychain(Pop3 pc, const char *username,
|
||||
get_password_from_keychain(Pop3 *pc, const char *username,
|
||||
const char *servername,
|
||||
/*@out@ */ char *password,
|
||||
/*@out@ */ size_t *password_len)
|
||||
|
@ -154,7 +154,7 @@ get_password_from_keychain(Pop3 pc, const char *username,
|
|||
|
||||
|
||||
static void
|
||||
get_password_from_command(Pop3 pc, const char *username,
|
||||
get_password_from_command(Pop3 *pc, const char *username,
|
||||
const char *servername,
|
||||
/*@out@ */ char *password,
|
||||
/*@out@ */
|
||||
|
@ -208,20 +208,19 @@ get_password_from_command(Pop3 pc, const char *username,
|
|||
}
|
||||
}
|
||||
|
||||
char *passwordFor(const char *username,
|
||||
const char *servername, Pop3 pc, int bFlushCache)
|
||||
char *passwordFor(const char *username, const char *servername, Pop3 *pc,
|
||||
int bFlushCache)
|
||||
{
|
||||
|
||||
password_binding p;
|
||||
password_binding *p;
|
||||
|
||||
assert(username != NULL);
|
||||
assert(username[0] != '\0');
|
||||
|
||||
/* find the binding */
|
||||
for (p = pass_list;
|
||||
p != NULL
|
||||
&& (strcmp(username, p->user) != 0 ||
|
||||
strcmp(servername, p->server) != 0); p = p->next);
|
||||
p != NULL && (strcmp(username, p->user) != 0 ||
|
||||
strcmp(servername, p->server) != 0); p = p->next);
|
||||
|
||||
/* if so, return the password */
|
||||
if (p != NULL) {
|
||||
|
@ -241,8 +240,7 @@ char *passwordFor(const char *username,
|
|||
return (NULL);
|
||||
}
|
||||
} else {
|
||||
p = (password_binding)
|
||||
malloc(sizeof(struct password_binding_struct));
|
||||
p = malloc(sizeof *p);
|
||||
}
|
||||
|
||||
/* else, try to get it. */
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include "Client.h"
|
||||
|
||||
/*@mustfree@*/ char *passwordFor(const char *username,
|
||||
const char *servername, Pop3 pc,
|
||||
int bFlushCache);
|
||||
/*@mustfree@*/
|
||||
char *passwordFor(const char *username, const char *servername, Pop3 *pc,
|
||||
int bFlushCache);
|
||||
|
||||
/* tested by test_wmbiff; don't use this for anything. */
|
||||
int permissions_ok(Pop3 pc, const char *askpass_fname);
|
||||
int permissions_ok(Pop3 *pc, const char *askpass_fname);
|
||||
|
|
|
@ -75,7 +75,7 @@ printf("FAILED: expected '" #shouldbe "' but got '%s'\n", x); \
|
|||
int test_passwordMgr(void)
|
||||
{
|
||||
const char *b;
|
||||
mbox_t m;
|
||||
Pop3 m;
|
||||
strcpy(m.label, "x");
|
||||
|
||||
/* sh is almost certainly conforming; owned by root, etc. */
|
||||
|
@ -183,7 +183,7 @@ printf("Failed: expected '" #shouldbe "' but got '%d'\n", x); \
|
|||
return 1; }
|
||||
int test_imap4creator(void)
|
||||
{
|
||||
mbox_t m;
|
||||
Pop3 m;
|
||||
|
||||
if (imap4Create(&m, "imap:foo:@bar/mybox")) {
|
||||
return 1;
|
||||
|
|
|
@ -65,7 +65,7 @@ struct connection_state {
|
|||
/*@null@ */ void *xcred;
|
||||
#endif
|
||||
char unprocessed[BUF_SIZE];
|
||||
Pop3 pc; /* mailbox handle for debugging messages */
|
||||
Pop3 *pc; /* mailbox handle for debugging messages */
|
||||
};
|
||||
|
||||
/* gotta do our own line buffering, sigh */
|
||||
|
@ -200,7 +200,7 @@ getline_from_buffer(char *readbuffer, char *linebuffer, int linebuflen)
|
|||
/* return the length of the line */
|
||||
}
|
||||
if (i < 0 || i > linebuflen) {
|
||||
DM((Pop3) NULL, DEBUG_ERROR, "bork bork bork!: %d %d\n", i,
|
||||
DM((Pop3 *) NULL, DEBUG_ERROR, "bork bork bork!: %d %d\n", i,
|
||||
linebuflen);
|
||||
}
|
||||
return i;
|
||||
|
@ -541,7 +541,7 @@ tls_check_certificate(struct connection_state *scs,
|
|||
return;
|
||||
}
|
||||
|
||||
struct connection_state *initialize_gnutls(intptr_t sd, char *name, Pop3 pc,
|
||||
struct connection_state *initialize_gnutls(intptr_t sd, char *name, Pop3 *pc,
|
||||
const char *remote_hostname)
|
||||
{
|
||||
static int gnutls_initialized;
|
||||
|
@ -661,7 +661,7 @@ void handle_gnutls_read_error(int readbytes, struct connection_state *scs)
|
|||
/* declare stubs when tls isn't compiled in */
|
||||
struct connection_state *initialize_gnutls(UNUSED(intptr_t sd),
|
||||
UNUSED(char *name),
|
||||
UNUSED(Pop3 pc),
|
||||
UNUSED(Pop3 *pc),
|
||||
UNUSED(const char
|
||||
*remote_hostname))
|
||||
{
|
||||
|
@ -674,7 +674,7 @@ struct connection_state *initialize_gnutls(UNUSED(intptr_t sd),
|
|||
/* either way: */
|
||||
struct connection_state *initialize_unencrypted(int sd,
|
||||
/*@only@ */ char *name,
|
||||
Pop3 pc)
|
||||
Pop3 *pc)
|
||||
{
|
||||
struct connection_state *ret = malloc(sizeof(struct connection_state));
|
||||
assert(sd >= 0);
|
||||
|
|
|
@ -20,14 +20,16 @@ struct connection_state;
|
|||
/* take a socket descriptor and negotiate a TLS connection
|
||||
over it */
|
||||
/*@only@*/
|
||||
struct connection_state *initialize_gnutls(intptr_t sd, /*@only@ */ char *name,
|
||||
Pop3 pc, const char *hostname);
|
||||
struct connection_state *initialize_gnutls(intptr_t sd,
|
||||
/* @only@ */ char *name,
|
||||
Pop3 *pc,
|
||||
const char *hostname);
|
||||
|
||||
/* take a socket descriptor and bundle it into a connection
|
||||
state structure for later communication */
|
||||
/*@only@*/
|
||||
struct connection_state *initialize_unencrypted(int sd, /*@only@ */
|
||||
char *name, Pop3 pc);
|
||||
char *name, Pop3 * pc);
|
||||
|
||||
/* store a binding when connect() times out. these should be
|
||||
skipped when trying to check mail so that other mailboxes
|
||||
|
|
|
@ -55,7 +55,7 @@ static const int wmbiff_mask_width = 64;
|
|||
#define DEFAULT_LOOP 5
|
||||
|
||||
#define MAX_NUM_MAILBOXES 40
|
||||
static mbox_t mbox[MAX_NUM_MAILBOXES];
|
||||
static Pop3 mbox[MAX_NUM_MAILBOXES];
|
||||
|
||||
/* this is the normal pixmap. */
|
||||
static const char *skin_filename = "wmbiff-master-led.xpm";
|
||||
|
@ -191,7 +191,7 @@ static int ReadLine(FILE * fp, /*@out@ */ char *setting,
|
|||
|
||||
struct path_demultiplexer {
|
||||
const char *id; /* followed by a colon */
|
||||
int (*creator) ( /*@notnull@ */ Pop3 pc, const char *path);
|
||||
int (*creator)( /*@notnull@ */ Pop3 *pc, const char *path);
|
||||
};
|
||||
|
||||
static struct path_demultiplexer paths[] = {
|
||||
|
|
Loading…
Reference in a new issue