X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fuser_ops.h;h=15107af7db79d1955677fefcfb61f18b37378a52;hb=11e722f9406b58f2884d6d63f4acba49b668f53f;hp=c0cf9f9ebd31cd4425c2281922ee41194d8a6e77;hpb=34fd48d16bdc678356d400eb1584fe3bb13d2cee;p=citadel.git diff --git a/citadel/user_ops.h b/citadel/user_ops.h index c0cf9f9eb..15107af7d 100644 --- a/citadel/user_ops.h +++ b/citadel/user_ops.h @@ -1,4 +1,8 @@ -/* $Id$ */ +#ifndef __USER_OPS_H__ +#define __USER_OPS_H__ + +#include +#include int hash (char *str); /* getuser is deprecated, use CtdlGetUser instead */ int getuser (struct ctdluser *, char *) __attribute__ ((deprecated)); @@ -16,9 +20,8 @@ void rebuild_usersbynumber(void); void cmd_user (char *cmdbuf); void session_startup (void); void logged_in_response(void); -void logout (void); int purge_user (char *pname); -int create_user (char *newusername, int become_user); +int create_user (const char *newusername, long len, int become_user); void do_login(void); int CtdlInvtKick(char *iuser, int op); void ForEachUser(void (*CallBack)(struct ctdluser *EachUser, void *out_data), @@ -26,7 +29,7 @@ void ForEachUser(void (*CallBack)(struct ctdluser *EachUser, void *out_data), void ListThisUser(struct ctdluser *usbuf, void *data); int NewMailCount(void); int InitialMailCheck(void); -void put_visit(struct visit *newvisit); +void put_visit(visit *newvisit); /* MailboxName is deprecated us CtdlMailboxName instead */ void MailboxName(char *buf, size_t n, const struct ctdluser *who, const char *prefix) __attribute__ ((deprecated)); @@ -44,7 +47,6 @@ void CtdlSetPassword(char *new_pw); int CtdlForgetThisRoom(void); void cmd_newu (char *cmdbuf); -void BumpNewMailCounter(long); void start_chkpwd_daemon(void); @@ -54,5 +56,45 @@ void start_chkpwd_daemon(void); #define RENAMEUSER_ALREADY_EXISTS 3 /* An account with the desired new name already exists */ int rename_user(char *oldname, char *newname); -INLINE void makeuserkey(char *key, char *username); -int internal_create_user (char *username, struct ctdluser *usbuf, uid_t uid); + +///#ifndef CTDL_INLINE_USR +////#define CTDL_INLINE_USR static INLINE +///#endif + +///CTDL_INLINE_USR +static INLINE long cutuserkey(char *username) { + long len; + len = strlen(username); + if (len >= USERNAME_SIZE) + { + syslog(LOG_EMERG, "Username to long: %s", username); + cit_backtrace (); + len = USERNAME_SIZE - 1; + username[len]='\0'; + } + return len; +} + +/* + * makeuserkey() - convert a username into the format used as a database key + * (it's just the username converted into lower case) + */ +///CTDL_INLINE_USR +static INLINE void makeuserkey(char *key, const char *username, long len) { + int i; + + if (len >= USERNAME_SIZE) + { + syslog(LOG_EMERG, "Username to long: %s", username); + cit_backtrace (); + len = USERNAME_SIZE - 1; + } + for (i=0; i<=len; ++i) { + key[i] = tolower(username[i]); + } +} + + +int internal_create_user (const char *username, long len, struct ctdluser *usbuf, uid_t uid); + +#endif