libcli/security Provide a common, top level libcli/security/security.h
[sfrench/samba-autobuild/.git] / source3 / web / statuspage.c
index e684a075c25228762bdccf994dfdebdca84a32b1..85bd33b7de0d5da33432cfb56c23858c63abffc3 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "includes.h"
 #include "web/swat_proto.h"
+#include "libcli/security/security.h"
 
 #define _(x) lang_msg_rotate(talloc_tos(),x)
 
@@ -123,6 +124,7 @@ static void print_share_mode(const struct share_mode_entry *e,
                             void *dummy)
 {
        char           *utf8_fname;
+       char           *utf8_sharepath;
        int deny_mode;
        size_t converted_size;
 
@@ -171,16 +173,17 @@ static void print_share_mode(const struct share_mode_entry *e,
                printf("NONE            ");
        printf("</td>");
 
-       push_utf8_allocate(&utf8_fname, fname, &converted_size);
-       printf("<td>%s</td><td>%s</td></tr>\n",
-              utf8_fname,tstring(talloc_tos(),e->time.tv_sec));
-       SAFE_FREE(utf8_fname);
+       push_utf8_talloc(talloc_tos(), &utf8_fname, fname, &converted_size);
+       push_utf8_talloc(talloc_tos(), &utf8_sharepath, sharepath,
+                        &converted_size);
+       printf("<td>%s</td><td>%s</td><td>%s</td></tr>\n",
+              utf8_sharepath,utf8_fname,tstring(talloc_tos(),e->time.tv_sec));
+       TALLOC_FREE(utf8_fname);
 }
 
 
 /* kill off any connections chosen by the user */
-static int traverse_fn1(struct db_record *rec,
-                       const struct connections_key *key,
+static int traverse_fn1(const struct connections_key *key,
                        const struct connections_data *crec,
                        void *private_data)
 {
@@ -196,8 +199,7 @@ static int traverse_fn1(struct db_record *rec,
 }
 
 /* traversal fn for showing machine connections */
-static int traverse_fn2(struct db_record *rec,
-                        const struct connections_key *key,
+static int traverse_fn2(const struct connections_key *key,
                         const struct connections_data *crec,
                         void *private_data)
 {
@@ -221,8 +223,7 @@ static int traverse_fn2(struct db_record *rec,
 }
 
 /* traversal fn for showing share connections */
-static int traverse_fn3(struct db_record *rec,
-                        const struct connections_key *key,
+static int traverse_fn3(const struct connections_key *key,
                         const struct connections_data *crec,
                         void *private_data)
 {
@@ -322,7 +323,7 @@ void status_page(void)
                PID_or_Machine = 0;
        }
 
-       connections_forall(traverse_fn1, NULL);
+       connections_forall_read(traverse_fn1, NULL);
 
        initPid2Machine ();
 
@@ -345,7 +346,7 @@ void status_page(void)
 
        printf("<table>\n");
 
-       printf("<tr><td>%s</td><td>%s</td></tr>", _("version:"), SAMBA_VERSION_STRING);
+       printf("<tr><td>%s</td><td>%s</td></tr>", _("version:"), samba_version_string());
 
        fflush(stdout);
        printf("<tr><td>%s</td><td>%s</td>\n", _("smbd:"), smbd_running()?_("running"):_("not running"));
@@ -412,7 +413,7 @@ void status_page(void)
        }
        printf("</tr>\n");
 
-       connections_forall(traverse_fn2, NULL);
+       connections_forall_read(traverse_fn2, NULL);
 
        printf("</table><p>\n");
 
@@ -421,13 +422,14 @@ void status_page(void)
        printf("<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>\n\n",
                _("Share"), _("User"), _("Group"), _("PID"), _("Client"), _("Date"));
 
-       connections_forall(traverse_fn3, NULL);
+       connections_forall_read(traverse_fn3, NULL);
 
        printf("</table><p>\n");
 
        printf("<h3>%s</h3>\n", _("Open Files"));
        printf("<table border=1>\n");
-       printf("<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>\n", _("PID"), _("Sharing"), _("R/W"), _("Oplock"), _("File"), _("Date"));
+       printf("<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>\n",
+               _("PID"), _("UID"), _("Sharing"), _("R/W"), _("Oplock"), _("Share"), _("File"), _("Date"));
 
        locking_init_readonly();
        share_mode_forall(print_share_mode, NULL);