Browse Source

* Just some indenting

svn: 903
Bryan Drewery 22 năm trước cách đây
mục cha
commit
eb00a9de26
4 tập tin đã thay đổi với 53 bổ sung42 xóa
  1. 24 16
      src/auth.c
  2. 23 20
      src/auth.h
  3. 5 5
      src/binary.c
  4. 1 1
      src/binary.h

+ 24 - 16
src/auth.c

@@ -31,17 +31,18 @@
 #include "stat.h"
 
 #ifdef S_AUTHCMDS
-int 				auth_total = 0;
-static int 			max_auth = 100;
-struct auth_t 			*auth = NULL;
+int auth_total = 0;
+static int max_auth = 100;
+struct auth_t *auth = NULL;
 #endif /* S_AUTHCMDS */
 
 #if defined(S_AUTHHASH) || defined(S_DCCAUTH)
-char                            authkey[121] = "";      /* This is one of the keys used in the auth hash */
+char authkey[121] = "";         /* This is one of the keys used in the auth hash */
 #endif /* S_AUTHHASH || S_DCCAUTH */
 
 #ifdef S_AUTHCMDS
-void init_auth_max()
+void
+init_auth_max()
 {
   if (max_auth < 1)
     max_auth = 1;
@@ -51,12 +52,14 @@ void init_auth_max()
     auth = calloc(1, sizeof(struct auth_t) * max_auth);
 }
 
-static void expire_auths()
+static void
+expire_auths()
 {
   int i = 0, idle = 0;
 
-  if (!ischanhub()) return;
-  for (i = 0; i < auth_total;i++) {
+  if (!ischanhub())
+    return;
+  for (i = 0; i < auth_total; i++) {
     if (auth[i].authed) {
       idle = now - auth[i].atime;
       if (idle >= (60 * 60)) {
@@ -67,7 +70,8 @@ static void expire_auths()
 }
 #endif /* S_AUTHCMDS */
 
-void init_auth()
+void
+init_auth()
 {
 #ifdef S_AUTHCMDS
   init_auth_max();
@@ -76,7 +80,8 @@ void init_auth()
 }
 
 #if defined(S_AUTHHASH) || defined(S_DCCAUTH)
-char *makehash(struct userrec *u, char *randstring)
+char *
+makehash(struct userrec *u, char *randstring)
 {
   char hash[256] = "", *secpass = NULL;
 
@@ -84,8 +89,7 @@ char *makehash(struct userrec *u, char *randstring)
     secpass = strdup(get_user(&USERENTRY_SECPASS, u));
     secpass[strlen(secpass)] = 0;
   }
-  egg_snprintf(hash, sizeof hash, "%s%s%s", randstring, (secpass && secpass[0]) ? secpass : "" , 
-                                                        (authkey && authkey[0]) ? authkey : "");
+  egg_snprintf(hash, sizeof hash, "%s%s%s", randstring, (secpass && secpass[0]) ? secpass : "", (authkey && authkey[0]) ? authkey : "");
   if (secpass)
     free(secpass);
 
@@ -94,7 +98,8 @@ char *makehash(struct userrec *u, char *randstring)
 #endif /* S_AUTHHASH || S_DCCAUTH */
 
 #ifdef S_AUTHCMDS
-int new_auth(void)
+int
+new_auth(void)
 {
   int i = auth_total;
 
@@ -107,9 +112,11 @@ int new_auth(void)
 }
 
 /* returns 0 if not found, -1 if problem, and > 0 if found. */
-int findauth(char *host)
+int
+findauth(char *host)
 {
   int i = 0;
+
   if (!host || !host[0])
     return -1;
   for (i = 0; i < auth_total; i++) {
@@ -123,8 +130,9 @@ int findauth(char *host)
   }
   return -1;
 }
-  
-void removeauth(int n)
+
+void
+removeauth(int n)
 {
   putlog(LOG_DEBUG, "*", "Removing %s from auth list.", auth[n].host);
   auth_total--;

+ 23 - 20
src/auth.h

@@ -1,39 +1,42 @@
 #ifndef _AUTH_H
-#define _AUTH_H
+#  define _AUTH_H
 
-#include "crypt.h"
+#  include "crypt.h"
 
-#ifdef S_AUTHCMDS
+#  ifdef S_AUTHCMDS
 struct auth_t {
   struct userrec *user;
-#ifdef S_AUTHHASH 
-  char hash[MD5_HASH_LENGTH + 1];                /* used for dcc authing */
-#endif /* S_AUTHHASH */
+#    ifdef S_AUTHHASH
+  char hash[MD5_HASH_LENGTH + 1];       /* used for dcc authing */
+#    endif                      /* S_AUTHHASH */
   char nick[NICKLEN];
   char host[UHOSTLEN];
   int authed;
   int authing;
-  time_t authtime;       /* what time they authed at */
-  time_t atime;          /* when they last were active */
+  time_t authtime;              /* what time they authed at */
+  time_t atime;                 /* when they last were active */
 };
-#endif /* S_AUTHCMDS */
+#  endif
+       /* S_AUTHCMDS */
 
-# ifdef S_AUTHCMDS
+#  ifdef S_AUTHCMDS
 int new_auth();
 int findauth(char *);
 void removeauth(int);
-# endif /* S_AUTHCMDS */
-# if defined(S_AUTHHASH) || defined(S_DCCAUTH)
+#  endif/* S_AUTHCMDS */
+#  if defined(S_AUTHHASH) || defined(S_DCCAUTH)
 char *makehash(struct userrec *, char *);
-# endif /* S_AUTHHASH || S_DCCAUTH */
+#  endif/* S_AUTHHASH || S_DCCAUTH */
 
 
-#ifdef S_AUTHCMDS
-extern int			auth_total;
-extern struct auth_t		*auth;
-#endif /* S_AUTHCMDS */
-#if defined(S_AUTHHASH) || defined(S_DCCAUTH)
-extern char                     authkey[121];
-#endif /* S_AUTHHASH || S_DCCAUTH */
+#  ifdef S_AUTHCMDS
+extern int auth_total;
+extern struct auth_t *auth;
+#  endif
+       /* S_AUTHCMDS */
+#  if defined(S_AUTHHASH) || defined(S_DCCAUTH)
+extern char authkey[121];
+#  endif
+       /* S_AUTHHASH || S_DCCAUTH */
 
 #endif /* !_AUTH_H */

+ 5 - 5
src/binary.c

@@ -50,10 +50,10 @@ bin_md5(const char *fname, int todo)
 
   if (todo == WRITE_MD5) {
     char *fname_bak = NULL, s[DIRMAX] = "";
-    FILE *fn = NULL;			/* the new binary */
+    FILE *fn = NULL;            /* the new binary */
     int i = 0, fd = -1;
     size_t size = 0;
-   
+
 
     size = strlen(fname) + 2;
     fname_bak = calloc(1, size);
@@ -62,7 +62,7 @@ bin_md5(const char *fname, int todo)
 
     if (!(f = fopen(fname, "rb")))
       werr(ERR_BINSTAT);
-    
+
     fseek(f, 0, SEEK_END);
     size = ftell(f);
     fseek(f, 0, SEEK_SET);
@@ -77,7 +77,7 @@ bin_md5(const char *fname, int todo)
     }
 
     while ((len = fread(buf, 1, sizeof(buf) - 1, f))) {
-      if (i) {		/* to skip bytes for hash */
+      if (i) {                  /* to skip bytes for hash */
         i -= sizeof(buf) - 1;
         continue;
       }
@@ -94,7 +94,7 @@ bin_md5(const char *fname, int todo)
 
         enc_hash = encrypt_string(SALT1, hash);
         fwrite(enc_hash, strlen(enc_hash), 1, fn);
-        i = strlen(enc_hash);			/* skip the next strlen(enc_hash) bytes */
+        i = strlen(enc_hash);   /* skip the next strlen(enc_hash) bytes */
         free(enc_hash);
       }
     }

+ 1 - 1
src/binary.h

@@ -8,7 +8,7 @@ typedef struct encdata_struct {
 
 
 extern encdata_t encdata;
-extern int	checked_bin_buf;
+extern int checked_bin_buf;
 
 #  define WRITE_MD5 	1
 #  define GET_MD5		2