implement IAUTH client code to query a separate server before allowing
[ircu2.10.12-pk.git] / include / client.h
index ec918b007d08d24acc9fd831909b33d8368722f9..478f9bc4b2dc409c871cff6c17366525be63d6e8 100644 (file)
@@ -81,6 +81,8 @@ typedef unsigned long flagpage_t;
 #define FLAGSET_SET(set, flag) (set).bits[FLAGSET_INDEX(flag)] |= FLAGSET_MASK(flag)
 #define FLAGSET_CLEAR(set, flag) (set).bits[FLAGSET_INDEX(flag)] &= ~FLAGSET_MASK(flag)
 
+#define infousermodes "dioswkgx"
+
 enum Priv
   {
     PRIV_CHAN_LIMIT, /* no channel limit on oper */
@@ -111,8 +113,8 @@ enum Priv
     PRIV_SEE_OPERS, /* display hidden opers */
     PRIV_WIDE_GLINE, /* oper can set wider G-lines */
     PRIV_LIST_CHAN, /* oper can list secret channels */
-    PRIV_FORCE_OPMODE,
-    PRIV_FORCE_LOCAL_OPMODE,
+    PRIV_FORCE_OPMODE, /* can hack modes on quarantined channels */
+    PRIV_FORCE_LOCAL_OPMODE, /* can hack modes on quarantined local channels */
     PRIV_LAST_PRIV /* must be the same as the last priv */
   };
 
@@ -137,6 +139,7 @@ enum Flag
     FLAG_BURST,                     /* Server is receiving a net.burst */
     FLAG_BURST_ACK,                 /* Server is waiting for eob ack */
     FLAG_IPCHECK,                   /* Added or updated IPregistry data */
+    FLAG_IAUTHED,                   /* Got IAUTH response for user */
     FLAG_LOCOP,                     /* Local operator -- SRB */
     FLAG_SERVNOTICE,                /* server notices such as kill */
     FLAG_OPER,                      /* Operator */
@@ -209,6 +212,7 @@ struct Connection
   struct Socket       con_socket; /* socket descriptor for client */
   struct Timer        con_proc; /* process latent messages from client */
   struct AuthRequest* con_auth; /* auth request for client */
+  struct IAuthRequest* con_iauth; /* iauth request for client */
 };
 
 #define CONNECTION_MAGIC 0x12f955f3
@@ -306,6 +310,7 @@ struct Client {
 #define cli_socket(cli)                ((cli)->cli_connect->con_socket)
 #define cli_proc(cli)          ((cli)->cli_connect->con_proc)
 #define cli_auth(cli)          ((cli)->cli_connect->con_auth)
+#define cli_iauth(cli)          ((cli)->cli_connect->con_iauth)
 
 #define con_verify(con)                ((con)->con_magic == CONNECTION_MAGIC)
 #define con_magic(con)         ((con)->con_magic)
@@ -345,6 +350,7 @@ struct Client {
 #define con_socket(con)                ((con)->con_socket)
 #define con_proc(con)          ((con)->con_proc)
 #define con_auth(con)          ((con)->con_auth)
+#define con_iauth(con)          ((con)->con_iauth)
 
 #define STAT_CONNECTING         0x001 /* connecting to another server */
 #define STAT_HANDSHAKE          0x002 /* pass - server sent */
@@ -412,6 +418,7 @@ struct Client {
 #define IsDead(x)               HasFlag(x, FLAG_DEADSOCKET)
 #define IsDeaf(x)               HasFlag(x, FLAG_DEAF)
 #define IsIPChecked(x)          HasFlag(x, FLAG_IPCHECK)
+#define IsIAuthed(x)            HasFlag(x, FLAG_IAUTHED)
 #define IsIdented(x)            HasFlag(x, FLAG_GOTID)
 #define IsInvisible(x)          HasFlag(x, FLAG_INVISIBLE)
 #define IsJunction(x)           HasFlag(x, FLAG_JUNCTION)
@@ -440,6 +447,7 @@ struct Client {
 #define SetDebug(x)             SetFlag(x, FLAG_DEBUG)
 #define SetGotId(x)             SetFlag(x, FLAG_GOTID)
 #define SetIPChecked(x)         SetFlag(x, FLAG_IPCHECK)
+#define SetIAuthed(x)           SetFlag(x, FLAG_IAUTHED)
 #define SetInvisible(x)         SetFlag(x, FLAG_INVISIBLE)
 #define SetJunction(x)          SetFlag(x, FLAG_JUNCTION)
 #define SetLocOp(x)             SetFlag(x, FLAG_LOCOP)
@@ -453,6 +461,9 @@ struct Client {
 #define SetHiddenHost(x)        SetFlag(x, FLAG_HIDDENHOST)
 #define SetPingSent(x)          SetFlag(x, FLAG_PINGSENT)
 
+#define SeeOper(sptr,acptr) (IsAnOper(acptr) && (HasPriv(acptr, PRIV_DISPLAY) \
+                            || HasPriv(sptr, PRIV_SEE_OPERS)))
+
 #define ClearAccess(x)          ClrFlag(x, FLAG_CHKACCESS)
 #define ClearBurst(x)           ClrFlag(x, FLAG_BURST)
 #define ClearBurstAck(x)        ClrFlag(x, FLAG_BURST_ACK)
@@ -527,6 +538,7 @@ typedef enum ShowIPType {
 } ShowIPType;
 
 extern const char* get_client_name(const struct Client* sptr, int showip);
+extern const char* client_get_default_umode(const struct Client* sptr);
 extern int client_get_ping(const struct Client* local_client);
 extern void client_drop_sendq(struct Connection* con);
 extern void client_add_sendq(struct Connection* con,