]> jfr.im git - solanum.git/blobdiff - include/client.h
Make 5614c9e6f0b (opmod as fake statusmsg) optional
[solanum.git] / include / client.h
index a97b67bd09b435eb630dd132b2121587d09ec456..d3ff6a570d4f92852aa5a16673acfccd9a42ca28 100644 (file)
@@ -43,7 +43,6 @@ struct Blacklist;
 #define HOSTIPLEN      53      /* sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255.ipv6") */
 #define PASSWDLEN      128
 #define CIPHERKEYLEN   64      /* 512bit */
-#define CLIENT_BUFSIZE 512     /* must be at least 512 bytes */
 
 #define IDLEN          10
 
@@ -68,6 +67,8 @@ struct ListClient;
 struct scache_entry;
 struct ws_ctl;
 
+typedef int SSL_OPEN_CB(struct Client *, int status);
+
 /*
  * Client structures
  */
@@ -78,6 +79,9 @@ struct User
        char *away;             /* pointer to away message */
        int refcnt;             /* Number of times this block is referenced */
 
+       char *opername; /* name of operator{} block being used or tried (challenge) */
+       struct PrivilegeSet *privset;
+
        char suser[NICKLEN+1];
 };
 
@@ -125,7 +129,7 @@ struct Client
        unsigned long serial;   /* used to enforce 1 send per nick */
 
        /* client->name is the unique name for a client nick or host */
-       char name[HOSTLEN + 1];
+       char name[NAMELEN + 1];
 
        /*
         * client->username is the username from ident or the USER message,
@@ -224,7 +228,6 @@ struct LocalUser
         */
        char *passwd;
        char *auth_user;
-       char *opername; /* name of operator{} block being used or tried (challenge) */
        char *challenge;
        char *fullcaps;
        char *cipher_string;
@@ -252,7 +255,7 @@ struct LocalUser
         */
        int sent_parsed;        /* how many messages we've parsed in this second */
        time_t last_knock;      /* time of last knock */
-       unsigned long random_ping;
+       uint32_t random_ping;
 
        /* target change stuff */
        /* targets we're aware of (fnv32(use_id(target_p))):
@@ -275,18 +278,24 @@ struct LocalUser
        struct _ssl_ctl *ssl_ctl;               /* which ssl daemon we're associate with */
        struct _ssl_ctl *z_ctl;                 /* second ctl for ssl+zlib */
        struct ws_ctl *ws_ctl;                  /* ctl for wsockd */
+       SSL_OPEN_CB *ssl_callback;              /* ssl connection is now open */
        uint32_t localflags;
        struct ZipStats *zipstats;              /* zipstats */
        uint16_t cork_count;                    /* used for corking/uncorking connections */
        struct ev_entry *event;                 /* used for associated events */
 
-       struct PrivilegeSet *privset;           /* privset... */
-
        char sasl_agent[IDLEN];
        unsigned char sasl_out;
        unsigned char sasl_complete;
+
+       unsigned int sasl_messages;
+       unsigned int sasl_failures;
+       time_t sasl_next_retry;
 };
 
+#define AUTHC_F_DEFERRED 0x01
+#define AUTHC_F_COMPLETE 0x02
+
 struct AuthClient
 {
        uint32_t cid;   /* authd id */
@@ -295,6 +304,7 @@ struct AuthClient
        char cause;     /* rejection cause */
        char *data;     /* reason data */
        char *reason;   /* reason we were rejected */
+       int flags;
 };
 
 struct PreClient
@@ -306,6 +316,8 @@ struct PreClient
        struct AuthClient auth;
 
        struct rb_sockaddr_storage lip; /* address of our side of the connection */
+
+       char id[IDLEN]; /* UID/SID, unique on the network (unverified) */
 };
 
 struct ListClient
@@ -426,6 +438,8 @@ struct ListClient
 #define LFLAGS_SSL             0x00000001
 #define LFLAGS_FLUSH           0x00000002
 #define LFLAGS_CORK            0x00000004
+#define LFLAGS_SCTP            0x00000008
+#define LFLAGS_INSECURE        0x00000010      /* for marking SSL clients as insecure before registration */
 
 /* umodes, settable flags */
 /* lots of this moved to snomask -- jilles */
@@ -438,7 +452,6 @@ struct ListClient
 #define UMODE_SERVICE      0x0040
 #define UMODE_DEAF        0x0080
 #define UMODE_NOFORWARD    0x0100      /* don't forward */
-#define UMODE_REGONLYMSG   0x0200      /* only allow logged in users to msg */
 
 /* user information flags, only settable by remote mode or local oper */
 #define UMODE_OPER         0x1000      /* Operator */
@@ -496,6 +509,14 @@ struct ListClient
 #define SetFlush(x)            ((x)->localClient->localflags |= LFLAGS_FLUSH)
 #define ClearFlush(x)          ((x)->localClient->localflags &= ~LFLAGS_FLUSH)
 
+#define IsSCTP(x)              ((x)->localClient->localflags & LFLAGS_SCTP)
+#define SetSCTP(x)             ((x)->localClient->localflags |= LFLAGS_SCTP)
+#define ClearSCTP(x)           ((x)->localClient->localflags &= ~LFLAGS_SCTP)
+
+#define IsInsecure(x)          ((x)->localClient->localflags & LFLAGS_INSECURE)
+#define SetInsecure(x)         ((x)->localClient->localflags |= LFLAGS_INSECURE)
+#define ClearInsecure(x)       ((x)->localClient->localflags &= ~LFLAGS_INSECURE)
+
 /* oper flags */
 #define MyOper(x)               (MyConnect(x) && IsOper(x))
 
@@ -521,7 +542,6 @@ struct ListClient
 #define IsService(x)           ((x)->umodes & UMODE_SERVICE)
 #define IsDeaf(x)              ((x)->umodes & UMODE_DEAF)
 #define IsNoForward(x)         ((x)->umodes & UMODE_NOFORWARD)
-#define IsSetRegOnlyMsg(x)     ((x)->umodes & UMODE_REGONLYMSG)
 
 #define SetGotId(x)             ((x)->flags |= FLAGS_GOTID)
 #define IsGotId(x)              (((x)->flags & FLAGS_GOTID) != 0)
@@ -561,9 +581,15 @@ struct ListClient
 #define SHOW_IP 1
 #define MASK_IP 2
 
+enum
+{
+       D_LINED,
+       K_LINED
+};
+
 extern void check_banned_lines(void);
-extern void check_klines_event(void *unused);
 extern void check_klines(void);
+extern void check_one_kline(struct ConfItem *kline);
 extern void check_dlines(void);
 extern void check_xlines(void);
 extern void resv_nick_fnc(const char *mask, const char *reason, int temp_time);
@@ -574,8 +600,8 @@ extern int is_remote_connect(struct Client *);
 extern void init_client(void);
 extern struct Client *make_client(struct Client *from);
 extern void free_pre_client(struct Client *client);
-extern void free_client(struct Client *client);
 
+extern void notify_banned_client(struct Client *, struct ConfItem *, int ban);
 extern int exit_client(struct Client *, struct Client *, struct Client *, const char *);
 
 extern void error_exit_client(struct Client *, int);