X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fuser_ops.h;h=697554f13ffa61e1fcaa025965ffdd8b0d64dd3e;hb=c750a06a241dc2737fa68c24b340a1bd82894f74;hp=5ae367c8653b33547517d70ecdc41582552b90bb;hpb=fe98285b0cd9c7394dbc5d3f050bdeffa04fecb5;p=citadel.git diff --git a/citadel/user_ops.h b/citadel/user_ops.h index 5ae367c86..697554f13 100644 --- a/citadel/user_ops.h +++ b/citadel/user_ops.h @@ -1,33 +1,33 @@ -/* $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)); -/* lgetuser is deprecated, use CtdlGetUserLock instead */ -int lgetuser (struct ctdluser *, char *) __attribute__ ((deprecated)); -/* putuser is deprecated, use CtdlPutUser instead */ -void putuser (struct ctdluser *) __attribute__ ((deprecated)); -/* lputuser is deprecated, use CtdlPutUserLock instead */ -void lputuser (struct ctdluser *) __attribute__ ((deprecated)); int is_aide (void); int is_room_aide (void); -/* getuserbynumber is deprecated, use CtdlGetUserByNumber instead */ -int getuserbynumber (struct ctdluser *usbuf, long int number) __attribute__ ((deprecated)); +int CtdlCheckInternetMailPermission(struct ctdluser *who); void rebuild_usersbynumber(void); -void cmd_user (char *cmdbuf); void session_startup (void); void logged_in_response(void); -/* logout() is deprecated use CtdlUserLogout() instead */ -void logout (void) __attribute__ ((deprecated)); int purge_user (char *pname); -int create_user (char *newusername, int become_user); +int getuserbyuid(struct ctdluser *usbuf, uid_t number); + +int create_user(char *newusername, int become_user, uid_t uid); +enum { + CREATE_USER_DO_NOT_BECOME_USER, + CREATE_USER_BECOME_USER +}; +#define NATIVE_AUTH_UID (-1) + void do_login(void); int CtdlInvtKick(char *iuser, int op); -void ForEachUser(void (*CallBack)(struct ctdluser *EachUser, void *out_data), - void *in_data); +void ForEachUser(void (*CallBack)(struct ctdluser *EachUser, void *out_data), void *in_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)); @@ -45,7 +45,6 @@ void CtdlSetPassword(char *new_pw); int CtdlForgetThisRoom(void); void cmd_newu (char *cmdbuf); -void BumpNewMailCounter(long); void start_chkpwd_daemon(void); @@ -55,5 +54,43 @@ 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_INFO, "Username too long: %s", username); + 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_INFO, "Username too long: %s", username); + len = USERNAME_SIZE - 1; + } + for (i=0; i<=len; ++i) { + key[i] = tolower(username[i]); + } +} + + +int internal_create_user(char *username, struct ctdluser *usbuf, uid_t uid); + +#endif