Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source3/utils/status.c

    r414 r745  
    3232
    3333#include "includes.h"
     34#include "system/filesys.h"
     35#include "popt_common.h"
     36#include "dbwrap.h"
     37#include "../libcli/security/security.h"
     38#include "session.h"
     39#include "locking/proto.h"
     40#include "messages.h"
    3441
    3542#define SMB_MAXPIDS             2048
     
    233240}
    234241
    235 static int traverse_fn1(struct db_record *rec,
    236                         const struct connections_key *key,
     242static int traverse_fn1(const struct connections_key *key,
    237243                        const struct connections_data *crec,
    238244                        void *state)
     
    253259}
    254260
    255 static int traverse_sessionid(struct db_record *db, void *state)
    256 {
    257         struct sessionid sessionid;
     261static int traverse_sessionid(const char *key, struct sessionid *session,
     262                              void *private_data)
     263{
    258264        fstring uid_str, gid_str;
    259265
    260         if (db->value.dsize != sizeof(sessionid))
     266        if (!process_exists(session->pid)
     267            || !Ucrit_checkUid(session->uid)) {
    261268                return 0;
    262 
    263         memcpy(&sessionid, db->value.dptr, sizeof(sessionid));
    264 
    265         if (!process_exists(sessionid.pid) || !Ucrit_checkUid(sessionid.uid)) {
    266                 return 0;
    267         }
    268 
    269         Ucrit_addPid( sessionid.pid );
    270 
    271         fstr_sprintf(uid_str, "%u", (unsigned int)sessionid.uid);
    272         fstr_sprintf(gid_str, "%u", (unsigned int)sessionid.gid);
     269        }
     270
     271        Ucrit_addPid(session->pid);
     272
     273        fstr_sprintf(uid_str, "%u", (unsigned int)session->uid);
     274        fstr_sprintf(gid_str, "%u", (unsigned int)session->gid);
    273275
    274276        d_printf("%-7s   %-12s  %-12s  %-12s (%s)\n",
    275                  procid_str_static(&sessionid.pid),
    276                  numeric_only ? uid_str : uidtoname(sessionid.uid),
    277                  numeric_only ? gid_str : gidtoname(sessionid.gid),
    278                  sessionid.remote_machine, sessionid.hostname);
     277                 procid_str_static(&session->pid),
     278                 numeric_only ? uid_str : uidtoname(session->uid),
     279                 numeric_only ? gid_str : gidtoname(session->gid),
     280                 session->remote_machine, session->hostname);
    279281
    280282        return 0;
     
    312314        load_case_tables();
    313315
    314         setup_logging(argv[0],True);
    315 
    316         dbf = x_stderr;
     316        setup_logging(argv[0], DEBUG_STDERR);
    317317
    318318        if (getuid() != geteuid()) {
     
    413413
    414414        if ( show_processes ) {
    415                 struct db_context *db;
    416                 db = db_open(NULL, lock_path("sessionid.tdb"), 0,
    417                              TDB_CLEAR_IF_FIRST, O_RDONLY, 0644);
    418                 if (!db) {
    419                         d_printf("sessionid.tdb not initialised\n");
    420                 } else {
    421                         d_printf("\nSamba version %s\n",samba_version_string());
    422                         d_printf("PID     Username      Group         Machine                        \n");
    423                         d_printf("-------------------------------------------------------------------\n");
    424                         if (lp_security() == SEC_SHARE) {
    425                                 d_printf(" <processes do not show up in "
    426                                     "anonymous mode>\n");
    427                         }
    428 
    429                         db->traverse_read(db, traverse_sessionid, NULL);
    430                         TALLOC_FREE(db);
    431                 }
     415                d_printf("\nSamba version %s\n",samba_version_string());
     416                d_printf("PID     Username      Group         Machine                        \n");
     417                d_printf("-------------------------------------------------------------------\n");
     418                if (lp_security() == SEC_SHARE) {
     419                        d_printf(" <processes do not show up in "
     420                                 "anonymous mode>\n");
     421                }
     422
     423                sessionid_traverse_read(traverse_sessionid, NULL);
    432424
    433425                if (processes_only) {
     
    448440                d_printf("-------------------------------------------------------\n");
    449441
    450                 connections_forall(traverse_fn1, NULL);
     442                connections_forall_read(traverse_fn1, NULL);
    451443
    452444                d_printf("\n");
     
    461453                struct db_context *db;
    462454                db = db_open(NULL, lock_path("locking.tdb"), 0,
    463                              TDB_CLEAR_IF_FIRST, O_RDONLY, 0);
     455                             TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, O_RDONLY, 0);
    464456
    465457                if (!db) {
Note: See TracChangeset for help on using the changeset viewer.