You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.5 KiB
C
76 lines
2.5 KiB
C
/*
|
|
* ejabberd external authentication program
|
|
*
|
|
* (c) Alexander Vdolainen 2013, 2018, 2019, 2021 <alex@vapaa.xyz>
|
|
*
|
|
* this is free software: you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published
|
|
* by the Free Software Foundation, either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* this is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
* See the GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.";
|
|
*
|
|
*/
|
|
|
|
#ifndef __EJABBERDMSG_H__
|
|
#define __EJABBERDMSG_H__
|
|
|
|
/*
|
|
* in order to avoid extensive strncmps
|
|
* that's a way faster to precalculate
|
|
* djb hash for each action.
|
|
* according to documentation there are the few ones:
|
|
* = auth:user:server:password (authentication itself)
|
|
* = isuser:user:server (check is user exist)
|
|
* = setpass:user:server:password (set new password)
|
|
* = tryregister:user:server:password (try to register a new account)
|
|
* = removeuser:user:server (remove user's account)
|
|
* = removeuser3:user:server:password (the same as above, but works with
|
|
* right password only)
|
|
*/
|
|
#define AUTH_HASH 0x000000017C944157
|
|
#define ISUSER_HASH 0x00000653052FCFC0
|
|
#define SETPASS_HASH 0x0000D0B68C342068
|
|
#define TRYREGISTER_HASH 0xC0D7C0FAC0ED2809
|
|
#define REMOVEUSER_HASH 0x7272BF5C0AA994F2
|
|
#define REMOVEUSER3_HASH 0xC0CAAADD5FDC3365
|
|
|
|
/* type used for ejabberd action */
|
|
typedef enum {
|
|
EJA_AUTH = 1,
|
|
EJA_ISUSER = 2,
|
|
EJA_SETPASS = 3,
|
|
EJA_TRYREGISTER = 4,
|
|
EJA_REMOVEUSER = 5,
|
|
EJA_REMOVEUSER3 = 6,
|
|
EJA_UNKNOWN = 7,
|
|
} ejabber_action_t;
|
|
|
|
/* limits for allocation */
|
|
#define MAX_USER_LEN 256
|
|
#define MAX_DOMAIN_LEN 128
|
|
#define MAX_PASSWORD_LEN 128
|
|
|
|
struct ejabber_msg {
|
|
ejabber_action_t aev; /* message action */
|
|
char *msg_data; /* all data from the message */
|
|
char *user; /* pointer to the user part */
|
|
char *domain; /* pointer to the domain/server part of the message */
|
|
char *password; /* pointer to the password part of the message */
|
|
};
|
|
|
|
/* little helpers to avoid structure's names hunting */
|
|
#define ejabber_msg_event(c) (c)->aev
|
|
#define ejabber_msg_data(c) (c)->msg_data
|
|
#define ejabber_msg_user(c) (c)->user
|
|
#define ejabber_msg_domain(c) (c)->domain
|
|
#define ejabber_msg_password(c) (c)->password
|
|
|
|
#endif /* __EJABBERDMSG_H__ */
|