Renamed cutuserkey() to cutusername(). Function has nothing to do with keys.
[citadel.git] / citadel / user_ops.h
index 15107af7db79d1955677fefcfb61f18b37378a52..040932c1df29d33c5b196ead00d5ab9c900cd784 100644 (file)
@@ -1,31 +1,43 @@
+/* 
+ * Header file for server functions which perform operations on user objects.
+ *
+ * Copyright (c) 1987-2019 by the citadel.org team
+ *
+ * This program is open source software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License, version 3.
+ *
+ * This program 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.
+ */
+
 #ifndef __USER_OPS_H__
 #define __USER_OPS_H__
 
 #include <ctype.h>
 #include <syslog.h>
+
 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);
 int purge_user (char *pname);
-int create_user (const char *newusername, long len, 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);
@@ -57,44 +69,8 @@ void start_chkpwd_daemon(void);
 
 int rename_user(char *oldname, char *newname);
 
-///#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);
+long cutusername(char *username);
+void makeuserkey(char *key, const char *username, long len);
+int internal_create_user(char *username, struct ctdluser *usbuf, uid_t uid);
 
 #endif