Changeset 745 for trunk/server/source3/utils/status.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source3/utils/status.c
r414 r745 32 32 33 33 #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" 34 41 35 42 #define SMB_MAXPIDS 2048 … … 233 240 } 234 241 235 static int traverse_fn1(struct db_record *rec, 236 const struct connections_key *key, 242 static int traverse_fn1(const struct connections_key *key, 237 243 const struct connections_data *crec, 238 244 void *state) … … 253 259 } 254 260 255 static int traverse_sessionid( struct db_record *db, void *state)256 { 257 struct sessionid sessionid; 261 static int traverse_sessionid(const char *key, struct sessionid *session, 262 void *private_data) 263 { 258 264 fstring uid_str, gid_str; 259 265 260 if (db->value.dsize != sizeof(sessionid)) 266 if (!process_exists(session->pid) 267 || !Ucrit_checkUid(session->uid)) { 261 268 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); 273 275 274 276 d_printf("%-7s %-12s %-12s %-12s (%s)\n", 275 procid_str_static(&session id.pid),276 numeric_only ? uid_str : uidtoname(session id.uid),277 numeric_only ? gid_str : gidtoname(session id.gid),278 session id.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); 279 281 280 282 return 0; … … 312 314 load_case_tables(); 313 315 314 setup_logging(argv[0],True); 315 316 dbf = x_stderr; 316 setup_logging(argv[0], DEBUG_STDERR); 317 317 318 318 if (getuid() != geteuid()) { … … 413 413 414 414 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); 432 424 433 425 if (processes_only) { … … 448 440 d_printf("-------------------------------------------------------\n"); 449 441 450 connections_forall (traverse_fn1, NULL);442 connections_forall_read(traverse_fn1, NULL); 451 443 452 444 d_printf("\n"); … … 461 453 struct db_context *db; 462 454 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); 464 456 465 457 if (!db) {
Note:
See TracChangeset
for help on using the changeset viewer.