Back to index

citadel  8.12
user_ops.h
Go to the documentation of this file.
00001 #ifndef __USER_OPS_H__
00002 #define __USER_OPS_H__
00003 
00004 #include <ctype.h>
00005 #include <syslog.h>
00006 int hash (char *str);
00007 /* getuser is deprecated, use CtdlGetUser instead */
00008 int getuser (struct ctdluser *, char *) __attribute__ ((deprecated));
00009 /* lgetuser is deprecated, use CtdlGetUserLock instead */
00010 int lgetuser (struct ctdluser *, char *) __attribute__ ((deprecated));
00011 /* putuser is deprecated, use CtdlPutUser instead */
00012 void putuser (struct ctdluser *) __attribute__ ((deprecated));
00013 /* lputuser is deprecated, use CtdlPutUserLock instead */
00014 void lputuser (struct ctdluser *) __attribute__ ((deprecated));
00015 int is_aide (void);
00016 int is_room_aide (void);
00017 /* getuserbynumber is deprecated, use CtdlGetUserByNumber instead */
00018 int getuserbynumber (struct ctdluser *usbuf, long int number) __attribute__ ((deprecated));
00019 void rebuild_usersbynumber(void);
00020 void cmd_user (char *cmdbuf);
00021 void session_startup (void);
00022 void logged_in_response(void);
00023 int purge_user (char *pname);
00024 int create_user (const char *newusername, long len, int become_user);
00025 void do_login(void);
00026 int CtdlInvtKick(char *iuser, int op);
00027 void ForEachUser(void (*CallBack)(struct ctdluser *EachUser, void *out_data),
00028        void *in_data);
00029 void ListThisUser(struct ctdluser *usbuf, void *data);
00030 int NewMailCount(void);
00031 int InitialMailCheck(void);
00032 void put_visit(visit *newvisit);
00033 /* MailboxName is deprecated us CtdlMailboxName instead */
00034 void MailboxName(char *buf, size_t n, const struct ctdluser *who,
00035                const char *prefix) __attribute__ ((deprecated));
00036 int GenerateRelationshipIndex(  char *IndexBuf,
00037                                 long RoomID,
00038                                 long RoomGen,
00039                                 long UserID);
00040 int CtdlAssociateSystemUser(char *screenname, char *loginname);
00041 
00042 
00043 
00044 
00045 void CtdlSetPassword(char *new_pw);
00046 
00047 int CtdlForgetThisRoom(void);
00048 
00049 void cmd_newu (char *cmdbuf);
00050 void start_chkpwd_daemon(void);
00051 
00052 
00053 #define RENAMEUSER_OK                     0      /* Operation succeeded */
00054 #define RENAMEUSER_LOGGED_IN              1      /* Cannot rename a user who is currently logged in */
00055 #define RENAMEUSER_NOT_FOUND              2      /* The old user name does not exist */
00056 #define RENAMEUSER_ALREADY_EXISTS  3      /* An account with the desired new name already exists */
00057 
00058 int rename_user(char *oldname, char *newname);
00059 
00063 
00065 static INLINE long cutuserkey(char *username) { 
00066        long len;
00067        len = strlen(username);
00068        if (len >= USERNAME_SIZE)
00069        {
00070               syslog(LOG_INFO, "Username too long: %s", username);
00071               cit_backtrace ();
00072               len = USERNAME_SIZE - 1; 
00073               username[len]='\0';
00074        }
00075        return len;
00076 }
00077 
00078 /*
00079  * makeuserkey() - convert a username into the format used as a database key
00080  *             (it's just the username converted into lower case)
00081  */
00083 static INLINE void makeuserkey(char *key, const char *username, long len) {
00084        int i;
00085 
00086        if (len >= USERNAME_SIZE)
00087        {
00088               syslog(LOG_INFO, "Username too long: %s", username);
00089               cit_backtrace ();
00090               len = USERNAME_SIZE - 1; 
00091        }
00092        for (i=0; i<=len; ++i) {
00093               key[i] = tolower(username[i]);
00094        }
00095 }
00096 
00097 
00098 int internal_create_user (const char *username, long len, struct ctdluser *usbuf, uid_t uid);
00099 
00100 #endif