Moved makeuserkey() and cutuserkey() from user_ops.h to user_ops.c
[citadel.git] / citadel / user_ops.h
index 9c15804942996ab9a06bbce703dbbc5437f38f78..02bcf394babce2299a15790a1cae4eef042ff9a2 100644 (file)
@@ -12,11 +12,18 @@ void rebuild_usersbynumber(void);
 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);
@@ -48,44 +55,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_INFO, "Username too 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_INFO, "Username too 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 cutuserkey(char *username);
+void makeuserkey(char *key, const char *username, long len);
+int internal_create_user(char *username, struct ctdluser *usbuf, uid_t uid);
 
 #endif