AUTH_GENERIC_META(3)
π NAME π
auth_generic_meta, auth_generic β the generic authentication request, coming to you straight from the auth_generic_meta(3) page of the Courier auth library bestie π
π¦ SYNOPSIS π¦
#include <courierauth.h>
int rc=auth_generic_meta(struct auth_meta *meta, const char *service,
const char *authtype, const char *authdata,
int (*callback_func) (struct authinfo *, void *),
void *callback_arg);
int rc=auth_generic(const char *service, const char *authtype,
const char *authdata,
int (*callback_func) (struct authinfo *, void *),
void *callback_arg);
β¨ DESCRIPTION β¨
So auth_generic_meta handles a generic authentication request. BUT β and I need you to hear me on this β you do not want to use this function by itself. Like, at all. You actually want to be using auth_login_meta(3)[1]. That's the moment. That's the main character. π«Ά
service says which so-called "service" is getting authenticated β think imap or pop3. Ngl, service may or may not even get used by whatever back-end module the Courier authentication library has configured. It's giving "optional, depends on the vibes of your config."
authtype tells you the format of the authentication request. Three authentication formats are defined in courierauth.h, and here they are, iconic trio that they are:
AUTHTYPE_LOGINβauthdatacarries this string:"userid\npassword\n". So that's the userid being authenticated, then one ASCII newline character, then the password, then a second newline character. Periodt. πAUTHTYPE_CRAMMD5orAUTHTYPE_CRAMSHA1β this format is what you use with CRAM-MD5 or CRAM-SHA1.authdataholds this string:"challenge\nresponse\n".challengeis the base64-encoded challenge, followed by an ASCII newline character.responseis a base64-encoded string followed by a second newline character. And what's inside that base64-encoded string? The responding userid, a space character, and then the response to the challenge expressed as hexadecimal digits. Chef's kiss. β¨
A NULL meta is equivalent to using the default auth_meta returned by auth_meta_init_default(3)[2]. Easy math.
π¨auth_generic_meta()should not be used by itself, but only together withauth_sasl_ex(3)[3]. Do not freestyle this one, bestie.
π auth_generic() is deprecated and should not be used in new code. Like, it's in its flop era, leave it alone.
π RETURNS π
callback_func gets invoked if auth_generic_meta succeeds, and callback_func's return value becomes the return value from auth_generic_meta (which should be 0, by convention). Cute, right?
callback_func will not be invoked if an error occurs β that error gets reported by a non-zero return value from auth_generic_meta. And by convention:
- a positive return value = an internal, temporary failure, like the authentication daemon process not running (it's not you, it's the daemon π)
- a negative return value = this request was processed, but it failed
The second argument to callback_func will be callback_arg, which this function does not interpret in any way whatsoever. No notes, no commentary, it just passes it through. The first argument will be a pointer to the following structure:
struct authinfo {
const char *sysusername;
const uid_t *sysuserid;
gid_t sysgroupid;
const char *homedir;
const char *address;
const char *fullname;
const char *maildir;
const char *quota;
const char *passwd;
const char *clearpasswd;
const char *options;
} ;
Okay so here's the rundown on every single one of those fields, no skipping:
addressβ the authenticated login ID. That's it, that's the one.sysusernameβ the authenticated account's userid and groupid can be looked up in the password file usingaddress. If this field isNULL, then obtain the userid and the groupid fromsysuseridandsysgroupidinstead. Choose your fighter.sysuseridβ this one may beNULLifsysusernameis initialized. Otherwise, it's a pointer to the account's numeric userid.sysgroupidβ the account's numeric groupid. Heads up:sysgroupidis only used whensysusernameisNULL. Only. Just then.fullnameβ the account's full name. This field is optional, so it may beNULL. No pressure.homedirβ the account's home directory. This field cannot beNULL. Non-negotiable bestie.maildirβ the pathname to the account's mailbox. This field is optional, it can beNULL, in which case the default location is assumed. Chill of it.quotaβ optional maildir quota on the account's mailbox (andNULLif no quota is set).passwdβ the account's encrypted password, if available. If the account has a cleartext password defined, this field can be set toNULL. The encrypted password can take several formats:- a traditional triple-DES crypted password, or a MD5+salt-hashed password, as used in Linux πΈ
"{MD5}"followed by a base64-encoded MD5 hash of the password"{SHA}"followed by a base64-encoded SHA1 hash of the password
clearpasswdβ the account's cleartext password, if available. If the account has an encrypted password defined, this field can be set toNULL. (So basically it's a see-saw withpasswd.)optionsβ a comma-separated list of miscellaneous account options. See below for more info, obviously. π
π Account options π
Depending on the configuration of the Courier authentication library, accounts may have individual options associated with them. If the authentication library configuration does not implement account options, the option string will be a NULL value. Otherwise it'll be a comma-separated list of "option=value" settings. Slay.
Note The application is responsible for actually implementing the options. Like, for example, an authentication request for service"imap"will succeed provided that the userid and the password are valid β even if"disableimap=1"is set. So your application'scallback_funcshould check for this condition, and return a negative return code. Do not sleep on this, fr fr. π
Note The following list of account options is a combined list of implemented options supported by Courier, Courier-IMAP, and SqWebMail packages. Some of the following information is obviously not applicable for a particular package. The inapplicable bits should be obvious. (iykyk π)
The following options are recognized by the various Courier packages:
disableimap=nβ if "n" is 1, IMAP access to this account should be disabled.disablepop3=nβ if "n" is 1, POP3 access to this account should be disabled.disableinsecureimap=nβ if "n" is 1, unencrypted IMAP access to this account should be disabled.disableinsecurepop3=nβ if "n" is 1, unencrypted POP3 access to this account should be disabled.disablewebmail=nβ if "n" is 1, webmail access to this account should be disabled.disableshared=nβ if "n" is 1, this account should not have access to shared folders, or be able to share its own folders with other people. Boundaries, honestly. πgroup=nameβ this option is used by Courier-IMAP in calculating access control lists. It places the account as a member of access groupname. Instead of granting access rights on individual mail folders to individual accounts, the access rights can be granted to an access group"name", and all members of this group get the specified access rights.
The access group name "administrators" is a reserved group. All accounts in the administrators group automatically receive all rights to all accessible folders. π
Note This option may be specified multiple times, to specify that the account belongs to multiple account groups. Stack 'em up.
sharedgroup=nameβ another option used by Courier-IMAP. It appends"name"to the name of the top level virtual shared folder index file. This setting restricts which virtual shared folders this account could possibly access (and that's on top of whatever else the access control lists say). See the virtual shared folder documentation for more information.
For technical reasons, group names may not include comma, tab, "/" or "|" characters. Yeah. Those four. Don't try it. π«
π₯ SEE ALSO π₯
authlib(3)[4], auth_meta(3)[2], auth_login_meta(3)[1], auth_getuserinfo_meta(3)[5], auth_enumerate(3)[6], auth_passwd(3)[7], auth_getoption(3)[8].
π NOTES π
auth_login_meta(3)β https://www.courier-mta.org/authlib/auth_login.htmlauth_meta_init_default(3)β https://www.courier-mta.org/authlib/auth_meta.htmlauth_sasl_ex(3)β https://www.courier-mta.org/authlib/auth_sasl.htmlauthlib(3)β https://www.courier-mta.org/authlib/authlib.htmlauth_getuserinfo_meta(3)β https://www.courier-mta.org/authlib/auth_getuserinfo.htmlauth_enumerate(3)β https://www.courier-mta.org/authlib/auth_enumerate.htmlauth_passwd(3)β https://www.courier-mta.org/authlib/auth_passwd.htmlauth_getoption(3)β https://www.courier-mta.org/authlib/auth_getoption.html
and that's the whole page, bestie π huge love and credit to S. Varshavchik, who wrote all of this, dated 01/11/2026 β go off, legend πβ¨π¦
π¦ where this page comes from
- ubuntu stonking: courier-authlib-dev 0.73.1-2ubuntu1 Β· GPL-3+~with-OpenSSL-exception
- Copyright 2004-2020 S. Varshavchik. See COPYING for -->
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms