]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/fce_api.c
logger: remove flood protection and allocate messages
[netatalk.git] / etc / afpd / fce_api.c
index 8c7f48492d6b5af16618f7cb47a61e099ae4eb95..158ad608c1e370b9192af9b9e6fdc7fbae254947 100644 (file)
@@ -80,7 +80,11 @@ static unsigned char iobuf[MAXIOBUF];
 static const char **skip_files;
 static struct fce_close_event last_close_event;
 
-static char *fce_event_names[] = {
+/*
+ * This only initializes consecutive events beginning at 1, high
+ * numbered events must be initialized in the code
+ */
+static char *fce_event_names[FCE_LAST_EVENT + 1] = {
     "",
     "FCE_FILE_MODIFY",
     "FCE_FILE_DELETE",
@@ -295,6 +299,9 @@ static void send_fce_event(const AFPObj *obj, int event, const char *path, const
     if (first_event == true) {
         first_event = false;
 
+        fce_event_names[FCE_CONN_START] = "FCE_CONN_START";
+        fce_event_names[FCE_CONN_BROKEN] = "FCE_CONN_BROKEN";
+
         struct passwd *pwd = getpwuid(obj->uid);
         user = strdup(pwd->pw_name);
 
@@ -395,7 +402,7 @@ static void send_fce_event(const AFPObj *obj, int event, const char *path, const
         }
 
         /* build our data packet */
-        data_len = build_fce_packet(obj, iobuf, event, path, oldpath, getpid(), user, ++event_id);
+        data_len = build_fce_packet(obj, iobuf, event, path, oldpath, getpid(), user, event_id);
 
         sent_data = sendto(udp_entry->sock,
                            iobuf,
@@ -415,6 +422,8 @@ static void send_fce_event(const AFPObj *obj, int event, const char *path, const
             udp_entry->next_try_on_error = now + FCE_SOCKET_RETRY_DELAY_S;
         }
     }
+
+    event_id++;
 }
 
 static int add_udp_socket(const char *target_ip, const char *target_port )