]> granicus.if.org Git - neomutt/commitdiff
Add comment blocks to ~60 functions
authorRichard Russon <rich@flatcap.org>
Sat, 28 Oct 2017 16:19:31 +0000 (17:19 +0100)
committerRichard Russon <rich@flatcap.org>
Sun, 29 Oct 2017 00:22:44 +0000 (01:22 +0100)
12 files changed:
conn/conn.h
conn/conn_globals.c
conn/getdomain.c
conn/sasl.c
conn/sasl_plain.c
conn/socket.c
conn/ssl.c
conn/ssl_gnutls.c
conn/tunnel.c
hcache/hcache.h
lib/lib.h
lib/list.c

index 19af3420d1658a959391a3f72695e4c32e95aca0..3a723e1ec0fac02f7acb39666a4f7abbfbccdd10 100644 (file)
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+/**
+ * @page conn Connection Library
+ *
+ * Manage external connections.
+ *
+ * -# @subpage conn_globals
+ * -# @subpage conn_getdomain
+ * -# @subpage conn_sasl
+ * -# @subpage conn_sasl_plain
+ * -# @subpage conn_socket
+ * -# @subpage conn_ssl
+ * -# @subpage conn_ssl_gnutls
+ * -# @subpage conn_tunnel
+ */
+
 #ifndef _CONN_CONN_H
 #define _CONN_CONN_H
 
index bc137b54b13e8a78108938284039e6a333ba7df9..2f8ef5115f5a500c974d825a16c0f6a031e1c6d7 100644 (file)
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+/**
+ * @page conn_globals Connection Global Variables
+ *
+ * These global variables are private to the connection library.
+ *
+ * | Global Variable        | NeoMutt Config
+ * | :--------------------- | :------------------------
+ * | #CertificateFile       | $certificate_file
+ * | #ConnectTimeout        | $connect_timeout
+ * | #EntropyFile           | $entropy_file
+ * | #Preconnect            | $preconnect
+ * | #SslCaCertificatesFile | $ssl_ca_certificates_file
+ * | #SslCiphers            | $ssl_ciphers
+ * | #SslClientCert         | $ssl_client_cert
+ * | #SslMinDhPrimeBits     | $ssl_min_dh_prime_bits
+ * | #Tunnel                | $tunnel
+ */
+
 #include "config.h"
 
 short ConnectTimeout; /**< Config: $connect_timeout */
index f471a07a5f5416862cd0f119969ffa5a18d5d8b2..f415e997b2f81f78c688262a97b9b7f582ba8d26 100644 (file)
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+/**
+ * @page conn_getdomain DNS lookups
+ *
+ * DNS lookups
+ *
+ * | Function           | Description
+ * | :----------------- | :-----------------------------------
+ * | getdnsdomainname() | Lookup the host's name using DNS
+ */
+
 #include "config.h"
 #include <netdb.h>
 #include <string.h>
 #include "lib/memory.h"
 #include "lib/string2.h"
 
+/**
+ * getdnsdomainname - Lookup the host's name using DNS
+ * @param d   Buffer for the result
+ * @param len Length of the buffer
+ * @retval  0 Success
+ * @retval -1 Error
+ */
 int getdnsdomainname(char *d, size_t len)
 {
   int ret = -1;
index 6b530a54cbf789c2af747d839212e06ce59b6482..8bf984ab408d4f029c3510eab2ad7c94265a1d6b 100644 (file)
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-/* common SASL helper routines */
-/* SASL can stack a protection layer on top of an existing connection.
- * To handle this, we store a saslconn_t in conn->sockdata, and write
- * wrappers which en/decode the read/write stream, then replace sockdata
- * with an embedded copy of the old sockdata and call the underlying
- * functions (which we've also preserved). I thought about trying to make
- * a general stackable connection system, but it seemed like overkill -
- * something is wrong if we have 15 filters on top of a socket. Anyway,
- * anything else which wishes to stack can use the same method. The only
- * disadvantage is we have to write wrappers for all the socket methods,
- * even if we only stack over read and write. Thinking about it, the
- * abstraction problem is that there is more in Connection than there
- * needs to be. Ideally it would have only (void*)data and methods. */
+/**
+ * @page conn_sasl SASL authentication support
+ *
+ * SASL can stack a protection layer on top of an existing connection.  To
+ * handle this, we store a saslconn_t in conn->sockdata, and write wrappers
+ * which en/decode the read/write stream, then replace sockdata with an
+ * embedded copy of the old sockdata and call the underlying functions (which
+ * we've also preserved). I thought about trying to make a general stackable
+ * connection system, but it seemed like overkill - something is wrong if we
+ * have 15 filters on top of a socket. Anyway, anything else which wishes to
+ * stack can use the same method. The only disadvantage is we have to write
+ * wrappers for all the socket methods, even if we only stack over read and
+ * write. Thinking about it, the abstraction problem is that there is more in
+ * Connection than there needs to be. Ideally it would have only (void*)data
+ * and methods.
+ *
+ * | Function               | Description
+ * | :--------------------- | :-----------------------------------
+ * | mutt_sasl_client_new() | wrapper for sasl_client_new
+ * | mutt_sasl_done()       | Invoke when processing is complete.
+ * | mutt_sasl_interact()   | Perform an SASL interaction with the user
+ * | mutt_sasl_setup_conn() | Set up an SASL connection
+ */
 
 #include "config.h"
 #include <errno.h>
@@ -65,6 +75,11 @@ static sasl_callback_t MuttSaslCallbacks[5];
 
 static sasl_secret_t *secret_ptr = NULL;
 
+/**
+ * getnameinfo_err - Convert a getaddrinfo() error code into an SASL error code
+ * @param ret getaddrinfo() error code, e.g. EAI_AGAIN
+ * @retval int SASL error code, e.g. SASL_FAIL
+ */
 static int getnameinfo_err(int ret)
 {
   int err;
@@ -115,6 +130,11 @@ static int getnameinfo_err(int ret)
 
 /**
  * iptostring - Convert IP Address to string
+ * @param addr    IP address
+ * @param addrlen Size of addr struct
+ * @param out     Buffer for result
+ * @param outlen  Length of buffer
+ * @retval int SASL error code, e.g. SASL_BADPARAM
  *
  * utility function, copied from sasl2 sample code
  */
@@ -145,6 +165,10 @@ static int iptostring(const struct sockaddr *addr, socklen_t addrlen, char *out,
 
 /**
  * mutt_sasl_cb_log - callback to log SASL messages
+ * @param context  Supplied context, always NULL
+ * @param priority Debug level
+ * @param message  Message
+ * @retval int SASL_OK, always
  */
 static int mutt_sasl_cb_log(void *context, int priority, const char *message)
 {
@@ -155,6 +179,7 @@ static int mutt_sasl_cb_log(void *context, int priority, const char *message)
 
 /**
  * mutt_sasl_start - Initialise SASL library
+ * @retval int SASL error code, e.g. SASL_OK
  *
  * Call before doing an SASL exchange - initialises library (if necessary).
  */
@@ -192,6 +217,11 @@ static int mutt_sasl_start(void)
 
 /**
  * mutt_sasl_cb_authname - callback to retrieve authname or user from Account
+ * @param[in]  context Account
+ * @param[in]  id      Field to get.  SASL_CB_USER or SASL_CB_AUTHNAME
+ * @param[out] result  Resulting string
+ * @param[out] len     Length of result
+ * @retval int SASL error code, e.g. SASL_FAIL
  */
 static int mutt_sasl_cb_authname(void *context, int id, const char **result, unsigned *len)
 {
@@ -230,6 +260,14 @@ static int mutt_sasl_cb_authname(void *context, int id, const char **result, uns
   return SASL_OK;
 }
 
+/**
+ * mutt_sasl_cb_pass - SASL callback function to get password
+ * @param[in]  conn    Connection to a server
+ * @param[in]  context Account
+ * @param[in]  id      SASL_CB_PASS
+ * @param[out] psecret SASL secret
+ * @retval int SASL error code, e.g SASL_FAIL
+ */
 static int mutt_sasl_cb_pass(sasl_conn_t *conn, void *context, int id, sasl_secret_t **psecret)
 {
   struct Account *account = (struct Account *) context;
@@ -254,6 +292,11 @@ static int mutt_sasl_cb_pass(sasl_conn_t *conn, void *context, int id, sasl_secr
   return SASL_OK;
 }
 
+/**
+ * mutt_sasl_get_callbacks - Get the SASL callback functions
+ * @param account Account to associate with callbacks
+ * @retval ptr Array of callback functions
+ */
 static sasl_callback_t *mutt_sasl_get_callbacks(struct Account *account)
 {
   sasl_callback_t *callback = NULL;
@@ -289,6 +332,9 @@ static sasl_callback_t *mutt_sasl_get_callbacks(struct Account *account)
 
 /**
  * mutt_sasl_conn_open - empty wrapper for underlying open function
+ * @param conn Connection to the server
+ * @retval  0 Success
+ * @retval -1 Error
  *
  * We don't know in advance that a connection will use SASL, so we replace
  * conn's methods with sasl methods when authentication is successful, using
@@ -309,6 +355,9 @@ static int mutt_sasl_conn_open(struct Connection *conn)
 
 /**
  * mutt_sasl_conn_close - close SASL connection
+ * @param conn Connection to a server
+ * @retval  0 Success
+ * @retval -1 Error
  *
  * Calls underlying close function and disposes of the sasl_conn_t object, then
  * restores connection to pre-sasl state
@@ -338,6 +387,14 @@ static int mutt_sasl_conn_close(struct Connection *conn)
   return rc;
 }
 
+/**
+ * mutt_sasl_conn_read - Read data from an SASL connection
+ * @param conn Connection to a server
+ * @param buf Buffer to store the data
+ * @param len Number of bytes to read
+ * @retval >0 Success, number of bytes read
+ * @retval -1 Error, see errno
+ */
 static int mutt_sasl_conn_read(struct Connection *conn, char *buf, size_t len)
 {
   struct SaslData *sasldata = NULL;
@@ -399,6 +456,14 @@ out:
   return rc;
 }
 
+/**
+ * mutt_sasl_conn_write - Write to an SASL connection
+ * @param conn Connection to a server
+ * @param buf Buffer to store the data
+ * @param len Number of bytes to read
+ * @retval >0 Success, number of bytes read
+ * @retval -1 Error, see errno
+ */
 static int mutt_sasl_conn_write(struct Connection *conn, const char *buf, size_t len)
 {
   struct SaslData *sasldata = NULL;
@@ -446,6 +511,14 @@ fail:
   return -1;
 }
 
+/**
+ * mutt_sasl_conn_poll - Check an SASL connection for data
+ * @param conn Connection to a server
+ * @param wait_secs How long to wait for a response
+ * @retval >0 There is data to read
+ * @retval  0 Read would block
+ * @retval -1 Connection doesn't support polling
+ */
 static int mutt_sasl_conn_poll(struct Connection *conn, time_t wait_secs)
 {
   struct SaslData *sasldata = conn->sockdata;
@@ -460,6 +533,10 @@ static int mutt_sasl_conn_poll(struct Connection *conn, time_t wait_secs)
 
 /**
  * mutt_sasl_client_new - wrapper for sasl_client_new
+ * @param conn     Connection to a server
+ * @param saslconn SASL connection
+ * @retval  0 Success
+ * @retval -1 Error
  *
  * which also sets various security properties. If this turns out to be fine
  * for POP too we can probably stop exporting mutt_sasl_get_callbacks().
@@ -566,6 +643,13 @@ int mutt_sasl_client_new(struct Connection *conn, sasl_conn_t **saslconn)
   return 0;
 }
 
+/**
+ * mutt_sasl_interact - Perform an SASL interaction with the user
+ * @param interaction Details of interaction
+ * @retval int SASL error code: SASL_OK or SASL_FAIL
+ *
+ * An example interaction might be asking the user for a password.
+ */
 int mutt_sasl_interact(sasl_interact_t *interaction)
 {
   char prompt[SHORT_STRING];
@@ -593,8 +677,10 @@ int mutt_sasl_interact(sasl_interact_t *interaction)
 
 /**
  * mutt_sasl_setup_conn - Set up an SASL connection
+ * @param conn Connection to a server
+ * @param saslconn SASL connection
  *
- * replace connection methods, sockdata with SASL wrappers, for protection
+ * Replace connection methods, sockdata with SASL wrappers, for protection
  * layers. Also get ssf, as a fastpath for the read/write methods.
  */
 void mutt_sasl_setup_conn(struct Connection *conn, sasl_conn_t *saslconn)
@@ -638,6 +724,7 @@ void mutt_sasl_setup_conn(struct Connection *conn, sasl_conn_t *saslconn)
 
 /*
  * mutt_sasl_done - Invoke when processing is complete.
+ *
  * This is a cleanup function, used to free all memory used by the library. 
  * Invoke when processing is complete.
  */
index 2cca9484220cc63c4cf5d2357e3f2771bcc42918..2f218df72be108e9e1482347446a2e1969bcfaa0 100644 (file)
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+/**
+ * @page conn_sasl_plain SASL plain authentication support
+ *
+ * SASL plain authentication support
+ *
+ * | Function              | Description
+ * | :-------------------- | :-----------------------------------
+ * | mutt_sasl_plain_msg() | Create an SASL command
+ */
+
 #include "config.h"
 #include <stdio.h>
 #include "lib/base64.h"
 #include "lib/string2.h"
 
+/**
+ * mutt_sasl_plain_msg - Create an SASL command
+ * @param buf    Buffer to store the command
+ * @param buflen Length of the buffer
+ * @param cmd    SASL command
+ * @param authz  Authorisation
+ * @param user   Username
+ * @param pass   Password
+ * @retval >0 Success, number of chars in the command string
+ * @retval  0 Error
+ *
+ * authz, user, and pass can each be up to 255 bytes, making up for a 765 bytes
+ * string. Add the two NULL bytes in between plus one at the end and we get
+ * 768.
+ */
 size_t mutt_sasl_plain_msg(char *buf, size_t buflen, const char *cmd,
                            const char *authz, const char *user, const char *pass)
 {
-  /* authz, user, and pass can each be up to 255 bytes, making up for a 765
-   * bytes string. Add the two NULL bytes in between plus one at the end and we
-   * get 768. */
   char tmp[768];
   size_t len;
   size_t tmplen;
index a49a8137f72bbc861ec1432cff9297431471e3a2..64b9f07209b4ca31339df7e1cf898858d66872b8 100644 (file)
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+/**
+ * @page conn_socket Low-level socket handling
+ *
+ * Low-level socket handling
+ *
+ * | Function               | Description
+ * | :--------------------- | :-----------------------------------
+ * | mutt_socket_close()    | Close a socket
+ * | mutt_socket_open()     | Simple wrapper
+ * | mutt_socket_poll()     | Checks whether reads would block
+ * | mutt_socket_readchar() | simple read buffering to speed things up
+ * | mutt_socket_readln_d() | Read a line from a socket
+ * | mutt_socket_write_d()  | Write data to a socket
+ * | raw_socket_close()     | Close a socket
+ * | raw_socket_open()      | Open a socket
+ * | raw_socket_poll()      | Checks whether reads would block
+ * | raw_socket_read()      | Read data from a socket
+ * | raw_socket_write()     | Write data to a socket
+ * | socket_new_conn()      | allocate and initialise a new connection
+ */
+
 #include "config.h"
 #include <time.h>
 #include <errno.h>
 #include "ssl.h"
 #endif
 
+/**
+ * socket_preconnect - Execute a command before opening a socket
+ * @retval 0  Success
+ * @retval >0 An errno, e.g. EPERM
+ */
 static int socket_preconnect(void)
 {
   int rc;
@@ -76,6 +102,11 @@ static int socket_preconnect(void)
 
 /**
  * socket_connect - set up to connect to a socket fd
+ * @param fd File descriptor to connect with
+ * @param sa Address info
+ * @retval  0 Success
+ * @retval >0 An errno, e.g. EPERM
+ * @retval -1 Error
  */
 static int socket_connect(int fd, struct sockaddr *sa)
 {
@@ -125,6 +156,9 @@ static int socket_connect(int fd, struct sockaddr *sa)
 
 /**
  * mutt_socket_open - Simple wrapper
+ * @param conn Connection to a server
+ * @retval  0 Success
+ * @retval -1 Error
  */
 int mutt_socket_open(struct Connection *conn)
 {
@@ -141,6 +175,12 @@ int mutt_socket_open(struct Connection *conn)
   return rc;
 }
 
+/**
+ * mutt_socket_close - Close a socket
+ * @param conn Connection to a server
+ * @retval  0 Success
+ * @retval -1 Error
+ */
 int mutt_socket_close(struct Connection *conn)
 {
   int rc = -1;
@@ -156,6 +196,15 @@ int mutt_socket_close(struct Connection *conn)
   return rc;
 }
 
+/**
+ * mutt_socket_write_d - Write data to a socket
+ * @param conn Connection to a server
+ * @param buf Buffer with data to write
+ * @param len Length of data to write
+ * @param dbg Debug level for logging
+ * @retval >0 Number of bytes written
+ * @retval -1 Error
+ */
 int mutt_socket_write_d(struct Connection *conn, const char *buf, int len, int dbg)
 {
   int rc;
@@ -194,7 +243,9 @@ int mutt_socket_write_d(struct Connection *conn, const char *buf, int len, int d
 }
 
 /**
- * mutt_socket_poll - poll whether reads would block
+ * mutt_socket_poll - Checks whether reads would block
+ * @param conn Connection to a server
+ * @param wait_secs How long to wait for a response
  * @retval >0 There is data to read
  * @retval  0 Read would block
  * @retval -1 Connection doesn't support polling
@@ -212,6 +263,10 @@ int mutt_socket_poll(struct Connection *conn, time_t wait_secs)
 
 /**
  * mutt_socket_readchar - simple read buffering to speed things up
+ * @param[in]  conn Connection to a server
+ * @param[out] c    Character that was read
+ * @retval  1 Success
+ * @retval -1 Error
  */
 int mutt_socket_readchar(struct Connection *conn, char *c)
 {
@@ -242,6 +297,15 @@ int mutt_socket_readchar(struct Connection *conn, char *c)
   return 1;
 }
 
+/**
+ * mutt_socket_readln_d - Read a line from a socket
+ * @param buf    Buffer to store the line
+ * @param buflen Length of data to write
+ * @param conn   Connection to a server
+ * @param dbg    Debug level for logging
+ * @retval >0 Success, number of bytes read
+ * @retval -1 Error
+ */
 int mutt_socket_readln_d(char *buf, size_t buflen, struct Connection *conn, int dbg)
 {
   char ch;
@@ -273,6 +337,7 @@ int mutt_socket_readln_d(char *buf, size_t buflen, struct Connection *conn, int
 
 /**
  * socket_new_conn - allocate and initialise a new connection
+ * @retval ptr New Connection
  */
 struct Connection *socket_new_conn(void)
 {
@@ -284,11 +349,25 @@ struct Connection *socket_new_conn(void)
   return conn;
 }
 
+/**
+ * raw_socket_close - Close a socket
+ * @param conn Connection to a server
+ * @retval  0 Success
+ * @retval -1 Error, see errno
+ */
 int raw_socket_close(struct Connection *conn)
 {
   return close(conn->fd);
 }
 
+/**
+ * raw_socket_read - Read data from a socket
+ * @param conn Connection to a server
+ * @param buf Buffer to store the data
+ * @param len Number of bytes to read
+ * @retval >0 Success, number of bytes read
+ * @retval -1 Error, see errno
+ */
 int raw_socket_read(struct Connection *conn, char *buf, size_t len)
 {
   int rc;
@@ -314,6 +393,14 @@ int raw_socket_read(struct Connection *conn, char *buf, size_t len)
   return rc;
 }
 
+/**
+ * raw_socket_write - Write data to a socket
+ * @param conn Connection to a server
+ * @param buf Buffer to read into
+ * @param count Number of bytes to read
+ * @retval >0 Success, number of bytes written
+ * @retval -1 Error, see errno
+ */
 int raw_socket_write(struct Connection *conn, const char *buf, size_t count)
 {
   int rc;
@@ -339,6 +426,14 @@ int raw_socket_write(struct Connection *conn, const char *buf, size_t count)
   return rc;
 }
 
+/**
+ * raw_socket_poll - Checks whether reads would block
+ * @param conn Connection to a server
+ * @param wait_secs How long to wait for a response
+ * @retval >0 There is data to read
+ * @retval  0 Read would block
+ * @retval -1 Connection doesn't support polling
+ */
 int raw_socket_poll(struct Connection *conn, time_t wait_secs)
 {
   fd_set rfds;
@@ -377,6 +472,12 @@ int raw_socket_poll(struct Connection *conn, time_t wait_secs)
   }
 }
 
+/**
+ * raw_socket_open - Open a socket
+ * @param conn Connection to a server
+ * @retval  0 Success
+ * @retval -1 Error
+ */
 int raw_socket_open(struct Connection *conn)
 {
   int rc;
index 8701670cdc9a3ba50f3dd3edc355c0add69f8d43..5aeffed51b1d8fe0ffaf7155f4f82d5d52929e33 100644 (file)
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+/**
+ * @page conn_ssl Handling of OpenSSL encryption
+ *
+ * Handling of OpenSSL encryption
+ *
+ * | Function                | Description
+ * | :---------------------- | :-----------------------------------
+ * | mutt_ssl_socket_setup() | Set up the socket multiplexor
+ * | mutt_ssl_starttls()     | Negotiate TLS over an already opened connection
+ */
+
 #include "config.h"
 #include <errno.h>
 #include <limits.h>
@@ -102,6 +113,9 @@ struct SslSockData
 
 /**
  * ssl_load_certificates - Load certificates and filter out the expired ones
+ * @param ctx SSL context
+ * @retval 1 Success
+ * @retval 0 Error
  *
  * ssl certificate verification can behave strangely if there are expired certs
  * loaded into the trusted store.  This function filters out expired certs.
@@ -155,6 +169,12 @@ static int ssl_load_certificates(SSL_CTX *ctx)
   return rv;
 }
 
+/**
+ * ssl_set_verify_partial - Allow verification using partial chains (with no root)
+ * @param ctx SSL context
+ * @retval  0 Success
+ * @retval -1 Error
+ */
 static int ssl_set_verify_partial(SSL_CTX *ctx)
 {
   int rv = 0;
@@ -185,6 +205,12 @@ static int ssl_set_verify_partial(SSL_CTX *ctx)
   return rv;
 }
 
+/**
+ * add_entropy - Add a source of random numbers
+ * @param file Random device
+ * @retval >0 Success, number of bytes read from the source
+ * @retval -1 Error
+ */
 static int add_entropy(const char *file)
 {
   struct stat st;
@@ -220,6 +246,11 @@ static int add_entropy(const char *file)
   return n;
 }
 
+/**
+ * ssl_err - Display an SSL error message
+ * @param data SSL socket data
+ * @param err  SSL error code
+ */
 static void ssl_err(struct SslSockData *data, int err)
 {
   int e = SSL_get_error(data->ssl, err);
@@ -287,6 +318,9 @@ static void ssl_err(struct SslSockData *data, int err)
 #endif
 }
 
+/**
+ * ssl_dprint_err_stack - Dump the SSL error stack (DEBUG only)
+ */
 static void ssl_dprint_err_stack(void)
 {
 #ifdef DEBUG
@@ -312,6 +346,15 @@ static void ssl_dprint_err_stack(void)
 #endif
 }
 
+/**
+ * ssl_passwd_cb - Callback to get a password
+ * @param buf      Buffer for the password
+ * @param size     Length of the buffer
+ * @param rwflag   0 if writing, 1 if reading (UNUSED)
+ * @param userdata Account whose password is requested
+ * @retval >0 Success, number of chars written to buf
+ * @retval  0 Error
+ */
 static int ssl_passwd_cb(char *buf, int size, int rwflag, void *userdata)
 {
   struct Account *account = (struct Account *) userdata;
@@ -328,6 +371,11 @@ static int ssl_passwd_cb(char *buf, int size, int rwflag, void *userdata)
   return snprintf(buf, size, "%s", account->pass);
 }
 
+/**
+ * ssl_socket_open_err - Error callback for opening an SSL connection
+ * @param conn Connection to a server
+ * @retval -1 Always
+ */
 static int ssl_socket_open_err(struct Connection *conn)
 {
   mutt_error(_("SSL disabled due to the lack of entropy"));
@@ -335,6 +383,12 @@ static int ssl_socket_open_err(struct Connection *conn)
   return -1;
 }
 
+/**
+ * ssl_socket_close - Close an SSL connection
+ * @param conn Connection to a server
+ * @retval  0 Success
+ * @retval -1 Error, see errno
+ */
 static int ssl_socket_close(struct Connection *conn)
 {
   struct SslSockData *data = conn->sockdata;
@@ -353,6 +407,14 @@ static int ssl_socket_close(struct Connection *conn)
   return raw_socket_close(conn);
 }
 
+/**
+ * x509_get_part - Retrieve from X509 data
+ * @param name Name of data to retrieve
+ * @param nid  ID of the item to retrieve
+ * @retval ptr Retrieved data
+ *
+ * The returned pointer is to a static buffer, so it must not be free()'d.
+ */
 static char *x509_get_part(X509_NAME *name, int nid)
 {
   static char ret[SHORT_STRING];
@@ -363,6 +425,13 @@ static char *x509_get_part(X509_NAME *name, int nid)
   return ret;
 }
 
+/**
+ * x509_fingerprint - Generate a fingerprint for an X509 certificate
+ * @param s        Buffer for fingerprint
+ * @param l        Length of buffer
+ * @param cert     Certificate
+ * @param hashfunc Hashing function
+ */
 static void x509_fingerprint(char *s, int l, X509 *cert, const EVP_MD *(*hashfunc)(void) )
 {
   unsigned char md[EVP_MAX_MD_SIZE];
@@ -383,6 +452,13 @@ static void x509_fingerprint(char *s, int l, X509 *cert, const EVP_MD *(*hashfun
   }
 }
 
+/**
+ * asn1time_to_string - Convert a time to a string
+ * @param tm Time to convert
+ * @retval ptr Time string
+ *
+ * The returned pointer is to a static buffer, so it must not be free()'d.
+ */
 static char *asn1time_to_string(ASN1_UTCTIME *tm)
 {
   static char buf[64];
@@ -401,6 +477,15 @@ static char *asn1time_to_string(ASN1_UTCTIME *tm)
   return buf;
 }
 
+/**
+ * compare_certificates - Compare two X509 certificated
+ * @param cert      Certificate
+ * @param peercert  Peer certificate
+ * @param peermd    Peer certificate message digest
+ * @param peermdlen Length of peer certificate message digest
+ * @retval true  Certificates match
+ * @retval false Certificates differ
+ */
 static bool compare_certificates(X509 *cert, X509 *peercert,
                                  unsigned char *peermd, unsigned int peermdlen)
 {
@@ -422,6 +507,13 @@ static bool compare_certificates(X509 *cert, X509 *peercert,
   return true;
 }
 
+/**
+ * check_certificate_expiration - Check if a certificate has expired
+ * @param peercert Certificate to check
+ * @param silent   If true, don't notify the user if the certificate has expired
+ * @retval true  Certificate is valid
+ * @retval false Certificate has expired (or hasn't yet become valid)
+ */
 static bool check_certificate_expiration(X509 *peercert, bool silent)
 {
   if (option(OPT_SSL_VERIFY_DATES) != MUTT_NO)
@@ -453,6 +545,9 @@ static bool check_certificate_expiration(X509 *peercert, bool silent)
 
 /**
  * hostname_match - Does the hostname match the certificate
+ * @param hostname Hostname
+ * @param certname Certificate
+ * @retval true Hostname matches the certificate
  */
 static bool hostname_match(const char *hostname, const char *certname)
 {
@@ -492,6 +587,8 @@ static bool hostname_match(const char *hostname, const char *certname)
 
 /**
  * ssl_init - Initialist the SSL library
+ * @retval  0 Success
+ * @retval -1 Error
  *
  * OpenSSL library needs to be fed with sufficient entropy. On systems with
  * /dev/urandom, this is done transparently by the library itself, on other
@@ -543,6 +640,14 @@ static int ssl_init(void)
   return 0;
 }
 
+/**
+ * ssl_socket_read - Read data from an SSL socket
+ * @param conn Connection to a server
+ * @param buf Buffer to store the data
+ * @param len Number of bytes to read
+ * @retval >0 Success, number of bytes read
+ * @retval -1 Error, see errno
+ */
 static int ssl_socket_read(struct Connection *conn, char *buf, size_t len)
 {
   struct SslSockData *data = conn->sockdata;
@@ -562,6 +667,14 @@ static int ssl_socket_read(struct Connection *conn, char *buf, size_t len)
   return rc;
 }
 
+/**
+ * ssl_socket_write - Write data to an SSL socket
+ * @param conn Connection to a server
+ * @param buf  Buffer to read into
+ * @param len  Number of bytes to read
+ * @retval >0 Success, number of bytes written
+ * @retval -1 Error, see errno
+ */
 static int ssl_socket_write(struct Connection *conn, const char *buf, size_t len)
 {
   struct SslSockData *data = conn->sockdata;
@@ -580,6 +693,11 @@ static int ssl_socket_write(struct Connection *conn, const char *buf, size_t len
   return rc;
 }
 
+/**
+ * ssl_get_client_cert - Get the client certificate for an SSL connection
+ * @param ssldata SSL socket data
+ * @param conn    Connection to a server
+ */
 static void ssl_get_client_cert(struct SslSockData *ssldata, struct Connection *conn)
 {
   if (SslClientCert)
@@ -595,6 +713,12 @@ static void ssl_get_client_cert(struct SslSockData *ssldata, struct Connection *
   }
 }
 
+/**
+ * tls_close - Close a TLS Connection
+ * @param conn Connection to a server
+ * @retval  0 Success
+ * @retval -1 Error, see errno
+ */
 static int tls_close(struct Connection *conn)
 {
   int rc;
@@ -607,6 +731,11 @@ static int tls_close(struct Connection *conn)
   return rc;
 }
 
+/**
+ * check_certificate_cache - Is the X509 Certificate in the cache?
+ * @param peercert Certificate
+ * @retval true Certificate is in the cache
+ */
 static bool check_certificate_cache(X509 *peercert)
 {
   unsigned char peermd[EVP_MAX_MD_SIZE];
@@ -630,6 +759,12 @@ static bool check_certificate_cache(X509 *peercert)
   return false;
 }
 
+/**
+ * check_certificate_file - Read and check a certificate file
+ * @param peercert Certificate
+ * @retval 1 Certificate is valid
+ * @retval 0 Error, or certificate is invalid
+ */
 static int check_certificate_file(X509 *peercert)
 {
   unsigned char peermd[EVP_MAX_MD_SIZE];
@@ -671,6 +806,12 @@ static int check_certificate_file(X509 *peercert)
 
 /**
  * check_host - Check the host on the certificate
+ * @param x509cert Certificate
+ * @param hostname Hostname
+ * @param err      Buffer for error message
+ * @param errlen   Length of buffer
+ * @retval 1 Hostname matches the certificate
+ * @retval 0 Error
  */
 static int check_host(X509 *x509cert, const char *hostname, char *err, size_t errlen)
 {
@@ -775,11 +916,23 @@ out:
   return rc;
 }
 
+/**
+ * check_certificate_by_digest - Validate a certificate by its digest
+ * @param peercert Certificate
+ * @retval 1 Certificate is valid
+ * @retval 0 Error
+ */
 static int check_certificate_by_digest(X509 *peercert)
 {
   return check_certificate_expiration(peercert, false) && check_certificate_file(peercert);
 }
 
+/**
+ * ssl_cache_trusted_cert - Cache a trusted certificate
+ * @param c Certificate
+ * @retval >0 Number of elements in the cache
+ * @retval  0 Error
+ */
 static int ssl_cache_trusted_cert(X509 *c)
 {
   mutt_debug(1, "ssl_cache_trusted_cert: trusted\n");
@@ -788,6 +941,16 @@ static int ssl_cache_trusted_cert(X509 *c)
   return (sk_X509_push(SslSessionCerts, X509_dup(c)));
 }
 
+/**
+ * interactive_check_cert - Ask the user if a certificate is valid
+ * @param cert         Certificate
+ * @param idx          Place of certificate in the chain
+ * @param len          Length of the certificate chain
+ * @param ssl          SSL state
+ * @param allow_always If certificate may be always allowed
+ * @retval true  User selected 'skip'
+ * @retval false Otherwise
+ */
 static int interactive_check_cert(X509 *cert, int idx, int len, SSL *ssl, int allow_always)
 {
   static const int part[] = {
@@ -948,7 +1111,11 @@ static int interactive_check_cert(X509 *cert, int idx, int len, SSL *ssl, int al
 }
 
 /**
- * ssl_verify_callback - certificate verification callback
+ * ssl_verify_callback - Certificate verification callback
+ * @param preverify_ok If true, don't question the user if they skipped verification
+ * @param ctx          X509 store context
+ * @retval true  Certificate is valid
+ * @retval false Error, or Certificate is invalid
  *
  * called for each certificate in the chain sent by the peer, starting from the
  * root; returning 1 means that the given certificate is trusted, returning 0
@@ -1078,6 +1245,10 @@ static int ssl_verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
 
 /**
  * ssl_negotiate - Attempt to negotiate SSL over the wire
+ * @param conn    Connection to a server
+ * @param ssldata SSL socket data
+ * @retval  0 Success
+ * @retval -1 Error
  *
  * After SSL state has been initialized, attempt to negotiate SSL over the
  * wire, including certificate checks.
@@ -1151,6 +1322,12 @@ static int ssl_negotiate(struct Connection *conn, struct SslSockData *ssldata)
   return 0;
 }
 
+/**
+ * ssl_socket_open - Open an SSL socket
+ * @param conn Connection to a server
+ * @retval  0 Success
+ * @retval -1 Error
+ */
 static int ssl_socket_open(struct Connection *conn)
 {
   struct SslSockData *data = NULL;
@@ -1247,6 +1424,9 @@ static int ssl_socket_open(struct Connection *conn)
 
 /**
  * mutt_ssl_starttls - Negotiate TLS over an already opened connection
+ * @param conn Connection to a server
+ * @retval  0 Success
+ * @retval -1 Error
  *
  * TODO: Merge this code better with ssl_socket_open.
  */
@@ -1365,6 +1545,12 @@ bail:
   return -1;
 }
 
+/**
+ * mutt_ssl_socket_setup - Set up the socket multiplexor
+ * @param conn Connection to a server
+ * @retval  0 Success
+ * @retval -1 Error
+ */
 int mutt_ssl_socket_setup(struct Connection *conn)
 {
   if (ssl_init() < 0)
index 9712d4da12cd6cf2ede2352d17481b711db15edb..a5f2ce831e7ce412a092c0aea6525baaa3e442e1 100644 (file)
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+/**
+ * @page conn_ssl_gnutls Handling of GnuTLS encryption
+ *
+ * Handling of GnuTLS encryption
+ *
+ * | Function                | Description
+ * | :---------------------- | :-----------------------------------
+ * | mutt_ssl_socket_setup() | Set up SSL socket mulitplexor
+ * | mutt_ssl_starttls()     | Set up TLS multiplexor
+ */
+
 #include "config.h"
 #include <gnutls/gnutls.h>
 #include <gnutls/x509.h>
@@ -71,6 +82,11 @@ struct TlsSockData
   gnutls_certificate_credentials_t xcred;
 };
 
+/**
+ * tls_init - Set up Gnu TLS
+ * @retval  0 Success
+ * @retval -1 Error
+ */
 static int tls_init(void)
 {
   static bool init_complete = false;
@@ -91,6 +107,14 @@ static int tls_init(void)
   return 0;
 }
 
+/**
+ * tls_socket_read - Read data from a TLS socket
+ * @param conn Connection to a server
+ * @param buf Buffer to store the data
+ * @param len Number of bytes to read
+ * @retval >0 Success, number of bytes read
+ * @retval -1 Error, see errno
+ */
 static int tls_socket_read(struct Connection *conn, char *buf, size_t len)
 {
   struct TlsSockData *data = conn->sockdata;
@@ -117,6 +141,14 @@ static int tls_socket_read(struct Connection *conn, char *buf, size_t len)
   return ret;
 }
 
+/**
+ * tls_socket_write - Write data to a TLS socket
+ * @param conn Connection to a server
+ * @param buf  Buffer to read into
+ * @param len  Number of bytes to read
+ * @retval >0 Success, number of bytes written
+ * @retval -1 Error, see errno
+ */
 static int tls_socket_write(struct Connection *conn, const char *buf, size_t len)
 {
   struct TlsSockData *data = conn->sockdata;
@@ -149,6 +181,12 @@ static int tls_socket_write(struct Connection *conn, const char *buf, size_t len
   return sent;
 }
 
+/**
+ * tls_socket_close - Close a TLS socket
+ * @param conn Connection to a server
+ * @retval  0 Success
+ * @retval -1 Error, see errno
+ */
 static int tls_socket_close(struct Connection *conn)
 {
   struct TlsSockData *data = conn->sockdata;
@@ -172,6 +210,12 @@ static int tls_socket_close(struct Connection *conn)
   return raw_socket_close(conn);
 }
 
+/**
+ * tls_starttls_close - Close a TLS connection
+ * @param conn Connection to a server
+ * @retval  0 Success
+ * @retval -1 Error, see errno
+ */
 static int tls_starttls_close(struct Connection *conn)
 {
   int rc;
@@ -186,6 +230,9 @@ static int tls_starttls_close(struct Connection *conn)
 
 /**
  * tls_verify_peers - wrapper for gnutls_certificate_verify_peers
+ * @param tlsstate TLS state
+ * @retval  0 Success
+ * @retval >0 Error, e.g. GNUTLS_CERT_INVALID
  *
  * wrapper with sanity-checking
  */
@@ -222,6 +269,13 @@ static gnutls_certificate_status_t tls_verify_peers(gnutls_session_t tlsstate)
   return status;
 }
 
+/**
+ * tls_fingerprint - Create a fingerprint of a TLS Certificate
+ * @param algo Fingerprint algorithm, e.g. GNUTLS_MAC_SHA256
+ * @param s    Buffer for the fingerprint
+ * @param l    Length of the buffer
+ * @param data Certificate
+ */
 static void tls_fingerprint(gnutls_digest_algorithm_t algo, char *s, int l,
                             const gnutls_datum_t *data)
 {
@@ -246,6 +300,13 @@ static void tls_fingerprint(gnutls_digest_algorithm_t algo, char *s, int l,
   }
 }
 
+/**
+ * tls_check_stored_hostname - Does the hostname match a stored certificate?
+ * @param cert     Certificate
+ * @param hostname Hostname
+ * @retval 1 Hostname match found
+ * @retval 0 Error, or no match
+ */
 static int tls_check_stored_hostname(const gnutls_datum_t *cert, const char *hostname)
 {
   char buf[80];
@@ -298,7 +359,10 @@ static int tls_check_stored_hostname(const gnutls_datum_t *cert, const char *hos
 }
 
 /**
- * tls_compare_certificates - Compare certificates
+ * tls_compare_certificates - Compare certificates against CertificateFile
+ * @param peercert Certificate
+ * @retval 1 Certificate matches file
+ * @retval 0 Error, or no match
  */
 static int tls_compare_certificates(const gnutls_datum_t *peercert)
 {
@@ -369,6 +433,17 @@ static int tls_compare_certificates(const gnutls_datum_t *peercert)
   return 0;
 }
 
+/**
+ * tls_check_preauth - Prepare a certificate for authentication
+ * @param[in]  certdata  List of GnuTLS certificates
+ * @param[in]  certstat  GnuTLS certificate status
+ * @param[in]  hostname  Hostname
+ * @param[in]  chainidx  Index in the certificate chain
+ * @param[out] certerr   Result, e.g. #CERTERR_VALID
+ * @param[out] savedcert 1 if certificate has been saved
+ * @retval  0 Success
+ * @retval -1 Error
+ */
 static int tls_check_preauth(const gnutls_datum_t *certdata,
                              gnutls_certificate_status_t certstat, const char *hostname,
                              int chainidx, int *certerr, int *savedcert)
@@ -486,6 +561,13 @@ static int tls_check_preauth(const gnutls_datum_t *certdata,
   return -1;
 }
 
+/**
+ * tls_make_date - Create a TLS date string
+ * @param t   Time to convert
+ * @param s   Buffer for the string
+ * @param len Length of the buffer
+ * @retval ptr Pointer to s
+ */
 static char *tls_make_date(time_t t, char *s, size_t len)
 {
   struct tm *l = gmtime(&t);
@@ -793,6 +875,12 @@ static int tls_check_one_certificate(const gnutls_datum_t *certdata,
   return (done == 2);
 }
 
+/**
+ * tls_check_certificate - Check a connection's certificate
+ * @param conn Connection to a server
+ * @retval >0 Certificate is valid
+ * @retval 0  Error, or certificate is invalid
+ */
 static int tls_check_certificate(struct Connection *conn)
 {
   struct TlsSockData *data = conn->sockdata;
@@ -871,6 +959,10 @@ static int tls_check_certificate(struct Connection *conn)
   return rc;
 }
 
+/**
+ * tls_get_client_cert - Get the client certificate for a TLS connection
+ * @param conn Connection to a server
+ */
 static void tls_get_client_cert(struct Connection *conn)
 {
   struct TlsSockData *data = conn->sockdata;
@@ -930,6 +1022,12 @@ err_crt:
 }
 
 #ifdef HAVE_GNUTLS_PRIORITY_SET_DIRECT
+/**
+ * tls_set_priority - Set TLS algorithm priorities
+ * @param data TLS socket data
+ * @retval  0 Success
+ * @retval -1 Error
+ */
 static int tls_set_priority(struct TlsSockData *data)
 {
   size_t nproto = 4;
@@ -1031,6 +1129,9 @@ static int tls_set_priority(struct TlsSockData *data)
 
 /**
  * tls_negotiate - Negotiate TLS connection
+ * @param conn Connection to a server
+ * @retval  0 Success
+ * @retval -1 Error
  *
  * After TLS state has been initialized, attempt to negotiate TLS over the
  * wire, including certificate checks.
@@ -1100,9 +1201,7 @@ static int tls_negotiate(struct Connection *conn)
     gnutls_dh_set_prime_bits(data->state, SslMinDhPrimeBits);
   }
 
-  /*
-  gnutls_set_cred (data->state, GNUTLS_ANON, NULL);
-*/
+  /* gnutls_set_cred (data->state, GNUTLS_ANON, NULL); */
 
   gnutls_credentials_set(data->state, GNUTLS_CRD_CERTIFICATE, data->xcred);
 
@@ -1155,6 +1254,12 @@ fail:
   return -1;
 }
 
+/**
+ * tls_socket_open - Open a TLS socket
+ * @param conn Connection to a server
+ * @retval  0 Success
+ * @retval -1 Error
+ */
 static int tls_socket_open(struct Connection *conn)
 {
   if (raw_socket_open(conn) < 0)
@@ -1169,6 +1274,12 @@ static int tls_socket_open(struct Connection *conn)
   return 0;
 }
 
+/**
+ * mutt_ssl_socket_setup - Set up SSL socket mulitplexor
+ * @param conn Connection to a server
+ * @retval  0 Success
+ * @retval -1 Error
+ */
 int mutt_ssl_socket_setup(struct Connection *conn)
 {
   if (tls_init() < 0)
@@ -1183,6 +1294,12 @@ int mutt_ssl_socket_setup(struct Connection *conn)
   return 0;
 }
 
+/**
+ * mutt_ssl_starttls - Set up TLS multiplexor
+ * @param conn Connection to a server
+ * @retval  0 Success
+ * @retval -1 Error
+ */
 int mutt_ssl_starttls(struct Connection *conn)
 {
   if (tls_init() < 0)
index a038913841266f21fd844b00edcf45858d0c1306..76205741527441c4811e136c049f74bb9ecbfc77 100644 (file)
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+/**
+ * @page conn_tunnel Support for network tunnelling 
+ *
+ * Support for network tunnelling
+ *
+ * | Function                   | Description
+ * | :------------------------- | :-----------------------------------
+ * | mutt_tunnel_socket_setup() | setups tunnel connection functions.
+ */
+
 #include "config.h"
 #include <errno.h>
 #include <fcntl.h>
@@ -52,6 +62,12 @@ struct TunnelData
   int writefd;
 };
 
+/**
+ * tunnel_socket_open - Open a tunnel socket
+ * @param conn Connection to a server
+ * @retval  0 Success
+ * @retval -1 Error
+ */
 static int tunnel_socket_open(struct Connection *conn)
 {
   struct TunnelData *tunnel = NULL;
@@ -130,6 +146,12 @@ static int tunnel_socket_open(struct Connection *conn)
   return 0;
 }
 
+/**
+ * tunnel_socket_close - Close a tunnel socket
+ * @param conn Connection to a server
+ * @retval  0 Success
+ * @retval -1 Error, see errno
+ */
 static int tunnel_socket_close(struct Connection *conn)
 {
   struct TunnelData *tunnel = (struct TunnelData *) conn->sockdata;
@@ -149,6 +171,14 @@ static int tunnel_socket_close(struct Connection *conn)
   return 0;
 }
 
+/**
+ * tunnel_socket_read - Read data from a tunnel socket
+ * @param conn Connection to a server
+ * @param buf Buffer to store the data
+ * @param len Number of bytes to read
+ * @retval >0 Success, number of bytes read
+ * @retval -1 Error, see errno
+ */
 static int tunnel_socket_read(struct Connection *conn, char *buf, size_t len)
 {
   struct TunnelData *tunnel = (struct TunnelData *) conn->sockdata;
@@ -164,6 +194,14 @@ static int tunnel_socket_read(struct Connection *conn, char *buf, size_t len)
   return rc;
 }
 
+/**
+ * tunnel_socket_write - Write data to a tunnel socket
+ * @param conn Connection to a server
+ * @param buf  Buffer to read into
+ * @param len  Number of bytes to read
+ * @retval >0 Success, number of bytes written
+ * @retval -1 Error, see errno
+ */
 static int tunnel_socket_write(struct Connection *conn, const char *buf, size_t len)
 {
   struct TunnelData *tunnel = (struct TunnelData *) conn->sockdata;
@@ -179,6 +217,14 @@ static int tunnel_socket_write(struct Connection *conn, const char *buf, size_t
   return rc;
 }
 
+/**
+ * tunnel_socket_poll - Checks whether tunnel reads would block
+ * @param conn Connection to a server
+ * @param wait_secs How long to wait for a response
+ * @retval >0 There is data to read
+ * @retval  0 Read would block
+ * @retval -1 Connection doesn't support polling
+ */
 static int tunnel_socket_poll(struct Connection *conn, time_t wait_secs)
 {
   struct TunnelData *tunnel = (struct TunnelData *) conn->sockdata;
index b3f6920f7cebf02ab35beced0453d46e6ddee692..772d749abb91079aff9db7b98ffd443a5eb3c288 100644 (file)
  * This module defines the user-visible header cache API, which is used within
  * neomutt to cache and restore mail header data.
  *
+ * @note This library isn't completely independent.
+ * Dependencies:
+ * - \ref lib
+ * - Global variables
+ *   * Charset
+ *   * Charset_is_utf8
+ *   * HeaderCacheBackend
+ *   * HeaderCachePageSize
+ *   * Options
+ *   * SpamList
+ *   * NoSpamList
+ * - Neomutt functions
+ *   * mutt_convert_string()
+ *   * mutt_encode_path()
+ *   * mutt_new_body()
+ *   * mutt_new_envelope()
+ *   * mutt_sleep()
+ *   * mx_lock_file()
+ *   * mx_unlock_file()
+ *
  * @subpage hc_hcache
  *
  * Backends:
index e6e32f025093d3d0042ac89f5f2e489d5ed06c4f..0d7af19a67810f998a11ffd89fa93a587e2c29bb 100644 (file)
--- a/lib/lib.h
+++ b/lib/lib.h
@@ -25,8 +25,8 @@
  *
  * Each source file in the library provides a group of related functions.
  *
- * The library is self-contained -- some files may depend on others in the
- * library, but none depends on source from outside.
+ * @note The library is self-contained -- some files may depend on others in
+ *       the library, but none depends on source from outside.
  *
  * -# @subpage base64
  * -# @subpage buffer
index b1c5f3dd70b9265b5c84d2df964ee95ef27f8f5f..b4a8e1ed968d596844a25cc77742390088831cc4 100644 (file)
@@ -73,7 +73,7 @@ struct ListNode *mutt_list_insert_tail(struct ListHead *h, char *s)
 /**
  * mutt_list_insert_after - Insert a string after a given ListNode
  * @param h Head of the List
- * @parem n ListNode after which the string will be inserted
+ * @param n ListNode after which the string will be inserted
  * @param s String to insert
  * @retval ptr Newly created ListNode containing the string
  */
@@ -87,8 +87,8 @@ struct ListNode *mutt_list_insert_after(struct ListHead *h, struct ListNode *n,
 
 /**
  * mutt_list_find - Find a string in a List
- * @param h Head of the List
- * @param s String to find
+ * @param h    Head of the List
+ * @param data String to find
  * @retval ptr ListNode containing the string
  * @retval NULL if the string isn't found
  */