2 Unix SMB/CIFS implementation.
4 Copyright (C) Andrew Tridgell 1994-1998
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 12 aug 96: Erik.Devriendt@te6.siemens.be
22 added support for shared memory implementation of share mode locking
24 21-Jul-1998: rsharpe@ns.aus.com (Richard Sharpe)
25 Added -L (locks only) -S (shares only) flags and code
30 * This program reports current SMB connections
34 #include "lib/util/server_id.h"
35 #include "smbd/globals.h"
36 #include "system/filesys.h"
37 #include "lib/cmdline/cmdline.h"
38 #include "dbwrap/dbwrap.h"
39 #include "dbwrap/dbwrap_open.h"
40 #include "../libcli/security/security.h"
42 #include "locking/share_mode_lock.h"
43 #include "locking/proto.h"
45 #include "librpc/gen_ndr/open_files.h"
46 #include "smbd/smbd.h"
47 #include "librpc/gen_ndr/notify.h"
50 #include "status_profile.h"
52 #include "status_json.h"
53 #include "smbd/notifyd/notifyd_db.h"
54 #include "cmdline_contexts.h"
55 #include "locking/leases_db.h"
56 #include "lib/util/string_wrappers.h"
60 #include "audit_logging.h" /* various JSON helpers */
61 #include "auth/common_auth.h"
62 #endif /* HAVE_JANSSON */
64 #define SMB_MAXPIDS 2048
65 static uid_t Ucrit_uid
= 0; /* added by OH */
66 static struct server_id Ucrit_pid
[SMB_MAXPIDS
]; /* Ugly !!! */ /* added by OH */
67 static int Ucrit_MaxPid
=0; /* added by OH */
68 static unsigned int Ucrit_IsActive
= 0; /* added by OH */
70 static bool verbose
, brief
;
71 static bool shares_only
; /* Added by RJS */
72 static bool locks_only
; /* Added by RJS */
73 static bool processes_only
;
75 static bool numeric_only
;
76 static bool do_checks
= true;
78 const char *username
= NULL
;
81 static void Ucrit_addUid(uid_t uid
)
87 static unsigned int Ucrit_checkUid(uid_t uid
)
89 if ( !Ucrit_IsActive
)
92 if ( uid
== Ucrit_uid
)
98 static unsigned int Ucrit_checkPid(struct server_id pid
)
102 if ( !Ucrit_IsActive
)
105 for (i
=0;i
<Ucrit_MaxPid
;i
++) {
106 if (server_id_equal(&pid
, &Ucrit_pid
[i
])) {
114 static bool Ucrit_addPid( struct server_id pid
)
116 if ( !Ucrit_IsActive
)
119 if ( Ucrit_MaxPid
>= SMB_MAXPIDS
) {
120 fprintf(stderr
, "ERROR: More than %d pids for user %s!\n",
121 SMB_MAXPIDS
, uidtoname(Ucrit_uid
));
126 Ucrit_pid
[Ucrit_MaxPid
++] = pid
;
131 static int print_share_mode_stdout(struct traverse_state
*state
,
133 const char *user_name
,
134 const char *denymode
,
138 const char *servicepath
,
139 const char *filename
,
143 d_printf("\nLocked files:\n");
144 d_printf("Pid User(ID) DenyMode Access R/W Oplock SharePath Name Time\n");
145 d_printf("--------------------------------------------------------------------------------------------------\n");
147 state
->first
= false;
150 d_printf("%-11s %-9s %-10s 0x%-8x %-10s %-14s %s %s %s",
151 pid
, user_name
, denymode
, access_mask
, rw
, oplock
,
152 servicepath
, filename
, timestr
);
156 static int prepare_share_mode(struct traverse_state
*state
)
158 /* only print header line if there are open files */
164 static int print_share_mode(struct file_id fid
,
165 const struct share_mode_data
*d
,
166 const struct share_mode_entry
*e
,
169 const char *denymode
= NULL
;
171 const char *oplock
= NULL
;
172 const char *pid
= NULL
;
173 const char *rw
= NULL
;
174 const char *filename
= NULL
;
175 const char *timestr
= NULL
;
176 const char *user_str
= NULL
;
177 struct traverse_state
*state
= (struct traverse_state
*)private_data
;
179 TALLOC_CTX
*tmp_ctx
= talloc_stackframe();
180 if (tmp_ctx
== NULL
) {
184 if (do_checks
&& !is_valid_share_mode_entry(e
)) {
185 TALLOC_FREE(tmp_ctx
);
189 if (do_checks
&& !serverid_exists(&e
->pid
)) {
190 /* the process for this entry does not exist any more */
191 TALLOC_FREE(tmp_ctx
);
195 if (Ucrit_checkPid(e
->pid
)) {
196 struct server_id_buf tmp
;
197 pid
= server_id_str_buf(e
->pid
, &tmp
);
198 if (state
->resolve_uids
) {
199 user_str
= talloc_asprintf(tmp_ctx
, "%s", uidtoname(e
->uid
));
201 user_str
= talloc_asprintf(tmp_ctx
, "%u", (unsigned int)e
->uid
);
203 if (user_str
== NULL
) {
204 TALLOC_FREE(tmp_ctx
);
208 denymode_int
= map_share_mode_to_deny_mode(e
->share_access
,
210 switch (denymode_int
) {
212 denymode
= "DENY_NONE";
215 denymode
= "DENY_ALL";
218 denymode
= "DENY_DOS";
221 denymode
= "DENY_READ";
224 denymode
= "DENY_WRITE";
227 denymode
= "DENY_FCB";
230 denymode
= talloc_asprintf(tmp_ctx
,
233 if (denymode
== NULL
) {
234 TALLOC_FREE(tmp_ctx
);
238 "unknown-please report ! "
239 "e->share_access = 0x%x, "
240 "e->private_options = 0x%x\n",
241 (unsigned int)e
->share_access
,
242 (unsigned int)e
->private_options
);
246 filename
= talloc_asprintf(tmp_ctx
,
249 (d
->stream_name
!= NULL
) ? d
->stream_name
: "");
250 if (filename
== NULL
) {
251 TALLOC_FREE(tmp_ctx
);
254 if ((e
->access_mask
& (FILE_READ_DATA
|FILE_WRITE_DATA
))==
255 (FILE_READ_DATA
|FILE_WRITE_DATA
)) {
257 } else if (e
->access_mask
& FILE_WRITE_DATA
) {
263 if (e
->op_type
& BATCH_OPLOCK
) {
265 } else if (e
->op_type
& EXCLUSIVE_OPLOCK
) {
266 oplock
= "EXCLUSIVE";
267 } else if (e
->op_type
& LEVEL_II_OPLOCK
) {
269 } else if (e
->op_type
== LEASE_OPLOCK
) {
273 status
= leases_db_get(
277 &lstate
, /* current_state */
279 NULL
, /* breaking_to_requested */
280 NULL
, /* breaking_to_required */
281 NULL
, /* lease_version */
284 if (NT_STATUS_IS_OK(status
)) {
285 oplock
= talloc_asprintf(tmp_ctx
, "LEASE(%s%s%s)%s%s%s",
286 (lstate
& SMB2_LEASE_READ
)?"R":"",
287 (lstate
& SMB2_LEASE_WRITE
)?"W":"",
288 (lstate
& SMB2_LEASE_HANDLE
)?"H":"",
289 (lstate
& SMB2_LEASE_READ
)?"":" ",
290 (lstate
& SMB2_LEASE_WRITE
)?"":" ",
291 (lstate
& SMB2_LEASE_HANDLE
)?"":" ");
293 oplock
= "LEASE STATE UNKNOWN";
299 timestr
= time_to_asc((time_t)e
->time
.tv_sec
);
300 print_share_mode_stdout(state
,
304 (unsigned int)e
->access_mask
,
311 TALLOC_FREE(tmp_ctx
);
315 static void print_brl_stdout(struct traverse_state
*state
,
321 const char *sharepath
,
325 d_printf("Byte range locks:\n");
326 d_printf("Pid dev:inode R/W start size SharePath Name\n");
327 d_printf("--------------------------------------------------------------------------------\n");
329 state
->first
= false;
331 d_printf("%-10s %-15s %-4s %-9jd %-9jd %-24s %-24s\n",
332 pid
, id
, desc
, start
, size
, sharepath
, fname
);
335 static int prepare_brl(struct traverse_state
*state
)
337 /* only print header line if there are locked files */
343 static void print_brl(struct file_id id
,
344 struct server_id pid
,
345 enum brl_type lock_type
,
346 enum brl_flavour lock_flav
,
352 static const struct {
353 enum brl_type lock_type
;
360 const char *desc
="X";
361 const char *sharepath
= "";
363 struct share_mode_lock
*share_mode
;
364 struct server_id_buf tmp
;
365 struct file_id_buf ftmp
;
366 struct traverse_state
*state
= (struct traverse_state
*)private_data
;
368 share_mode
= fetch_share_mode_unlocked(NULL
, id
);
370 fname
= share_mode_filename(NULL
, share_mode
);
372 fname
= talloc_strdup(NULL
, "");
378 for (i
=0;i
<ARRAY_SIZE(lock_types
);i
++) {
379 if (lock_type
== lock_types
[i
].lock_type
) {
380 desc
= lock_types
[i
].desc
;
384 print_brl_stdout(state
,
385 server_id_str_buf(pid
, &tmp
),
386 file_id_str_buf(id
, &ftmp
),
394 TALLOC_FREE(share_mode
);
397 static const char *session_dialect_str(uint16_t dialect
)
399 static fstring unknown_dialect
;
402 case SMB2_DIALECT_REVISION_000
:
404 case SMB2_DIALECT_REVISION_202
:
406 case SMB2_DIALECT_REVISION_210
:
408 case SMB2_DIALECT_REVISION_222
:
410 case SMB2_DIALECT_REVISION_224
:
412 case SMB3_DIALECT_REVISION_300
:
414 case SMB3_DIALECT_REVISION_302
:
416 case SMB3_DIALECT_REVISION_310
:
418 case SMB3_DIALECT_REVISION_311
:
422 fstr_sprintf(unknown_dialect
, "Unknown (0x%04x)", dialect
);
423 return unknown_dialect
;
426 static int traverse_connections_stdout(struct traverse_state
*state
,
427 const char *servicename
,
431 const char *encryption
,
434 d_printf("%-12s %-7s %-13s %-32s %-12s %-12s\n",
435 servicename
, server_id
, machine
, timestr
, encryption
, signing
);
440 static int prepare_connections(struct traverse_state
*state
)
442 /* always print header line */
443 d_printf("\n%-12s %-7s %-13s %-32s %-12s %-12s\n", "Service", "pid", "Machine", "Connected at", "Encryption", "Signing");
444 d_printf("---------------------------------------------------------------------------------------------\n");
449 static int traverse_connections(const struct connections_data
*crec
,
452 struct server_id_buf tmp
;
453 char *timestr
= NULL
;
455 const char *encryption
= "-";
456 const char *signing
= "-";
457 struct traverse_state
*state
= (struct traverse_state
*)private_data
;
459 TALLOC_CTX
*tmp_ctx
= talloc_stackframe();
460 if (tmp_ctx
== NULL
) {
464 if (crec
->cnum
== TID_FIELD_INVALID
) {
465 TALLOC_FREE(tmp_ctx
);
470 (!process_exists(crec
->pid
) || !Ucrit_checkUid(crec
->uid
))) {
471 TALLOC_FREE(tmp_ctx
);
475 timestr
= timestring(tmp_ctx
, crec
->start
);
476 if (timestr
== NULL
) {
477 TALLOC_FREE(tmp_ctx
);
481 if (smbXsrv_is_encrypted(crec
->encryption_flags
)) {
482 switch (crec
->cipher
) {
483 case SMB_ENCRYPTION_GSSAPI
:
484 encryption
= "GSSAPI";
486 case SMB2_ENCRYPTION_AES128_CCM
:
487 encryption
= "AES-128-CCM";
489 case SMB2_ENCRYPTION_AES128_GCM
:
490 encryption
= "AES-128-GCM";
499 if (smbXsrv_is_signed(crec
->signing_flags
)) {
500 switch (crec
->signing
) {
501 case SMB2_SIGNING_MD5_SMB1
:
502 signing
= "HMAC-MD5";
504 case SMB2_SIGNING_HMAC_SHA256
:
505 signing
= "HMAC-SHA256";
507 case SMB2_SIGNING_AES128_CMAC
:
508 signing
= "AES-128-CMAC";
510 case SMB2_SIGNING_AES128_GMAC
:
511 signing
= "AES-128-GMAC";
520 result
= traverse_connections_stdout(state
,
522 server_id_str_buf(crec
->pid
, &tmp
),
528 TALLOC_FREE(timestr
);
529 TALLOC_FREE(tmp_ctx
);
534 static int traverse_sessionid_stdout(struct traverse_state
*state
,
537 char *machine_hostname
,
539 const char *encryption_cipher
,
540 enum crypto_degree encryption_degree
,
541 const char *signing_cipher
,
542 enum crypto_degree signing_degree
)
547 if (encryption_degree
== CRYPTO_DEGREE_FULL
) {
548 fstr_sprintf(encryption
, "%s", encryption_cipher
);
549 } else if (encryption_degree
== CRYPTO_DEGREE_PARTIAL
) {
550 fstr_sprintf(encryption
, "partial(%s)", encryption_cipher
);
552 fstr_sprintf(encryption
, "-");
554 if (signing_degree
== CRYPTO_DEGREE_FULL
) {
555 fstr_sprintf(signing
, "%s", signing_cipher
);
556 } else if (signing_degree
== CRYPTO_DEGREE_PARTIAL
) {
557 fstr_sprintf(signing
, "partial(%s)", signing_cipher
);
559 fstr_sprintf(signing
, "-");
562 d_printf("%-7s %-25s %-41s %-17s %-20s %-21s\n",
563 server_id
, uid_gid_str
, machine_hostname
, dialect
, encryption
,
569 static int prepare_sessionid(struct traverse_state
*state
)
571 /* always print header line */
572 d_printf("\nSamba version %s\n",samba_version_string());
573 d_printf("%-7s %-12s %-12s %-41s %-17s %-20s %-21s\n", "PID", "Username", "Group", "Machine", "Protocol Version", "Encryption", "Signing");
574 d_printf("----------------------------------------------------------------------------------------------------------------------------------------\n");
580 static int traverse_sessionid(const char *key
, struct sessionid
*session
,
584 struct server_id_buf tmp
;
585 char *machine_hostname
= NULL
;
587 const char *encryption
= "-";
588 enum crypto_degree encryption_degree
= CRYPTO_DEGREE_NONE
;
589 const char *signing
= "-";
590 enum crypto_degree signing_degree
= CRYPTO_DEGREE_NONE
;
591 struct traverse_state
*state
= (struct traverse_state
*)private_data
;
593 TALLOC_CTX
*tmp_ctx
= talloc_stackframe();
594 if (tmp_ctx
== NULL
) {
599 (!process_exists(session
->pid
) ||
600 !Ucrit_checkUid(session
->uid
))) {
601 TALLOC_FREE(tmp_ctx
);
605 Ucrit_addPid(session
->pid
);
608 fstr_sprintf(uid_gid_str
, "%-12u %-12u",
609 (unsigned int)session
->uid
,
610 (unsigned int)session
->gid
);
612 if (session
->uid
== -1 && session
->gid
== -1) {
614 * The session is not fully authenticated yet.
616 fstrcpy(uid_gid_str
, "(auth in progress)");
619 * In theory it should not happen that one of
620 * session->uid and session->gid is valid (ie != -1)
621 * while the other is not (ie = -1), so we a check for
622 * that case that bails out would be reasonable.
624 const char *uid_name
= "-1";
625 const char *gid_name
= "-1";
627 if (session
->uid
!= -1) {
628 uid_name
= uidtoname(session
->uid
);
629 if (uid_name
== NULL
) {
630 TALLOC_FREE(tmp_ctx
);
634 if (session
->gid
!= -1) {
635 gid_name
= gidtoname(session
->gid
);
636 if (gid_name
== NULL
) {
637 TALLOC_FREE(tmp_ctx
);
641 fstr_sprintf(uid_gid_str
, "%-12s %-12s",
646 machine_hostname
= talloc_asprintf(tmp_ctx
, "%s (%s)",
647 session
->remote_machine
,
649 if (machine_hostname
== NULL
) {
650 TALLOC_FREE(tmp_ctx
);
654 if (smbXsrv_is_encrypted(session
->encryption_flags
) ||
655 smbXsrv_is_partially_encrypted(session
->encryption_flags
)) {
656 switch (session
->cipher
) {
657 case SMB2_ENCRYPTION_AES128_CCM
:
658 encryption
= "AES-128-CCM";
660 case SMB2_ENCRYPTION_AES128_GCM
:
661 encryption
= "AES-128-GCM";
663 case SMB2_ENCRYPTION_AES256_CCM
:
664 encryption
= "AES-256-CCM";
666 case SMB2_ENCRYPTION_AES256_GCM
:
667 encryption
= "AES-256-GCM";
674 if (smbXsrv_is_encrypted(session
->encryption_flags
)) {
675 encryption_degree
= CRYPTO_DEGREE_FULL
;
676 } else if (smbXsrv_is_partially_encrypted(session
->encryption_flags
)) {
677 encryption_degree
= CRYPTO_DEGREE_PARTIAL
;
681 if (smbXsrv_is_signed(session
->signing_flags
) ||
682 smbXsrv_is_partially_signed(session
->signing_flags
)) {
683 switch (session
->signing
) {
684 case SMB2_SIGNING_MD5_SMB1
:
685 signing
= "HMAC-MD5";
687 case SMB2_SIGNING_HMAC_SHA256
:
688 signing
= "HMAC-SHA256";
690 case SMB2_SIGNING_AES128_CMAC
:
691 signing
= "AES-128-CMAC";
693 case SMB2_SIGNING_AES128_GMAC
:
694 signing
= "AES-128-GMAC";
701 if (smbXsrv_is_signed(session
->signing_flags
)) {
702 signing_degree
= CRYPTO_DEGREE_FULL
;
703 } else if (smbXsrv_is_partially_signed(session
->signing_flags
)) {
704 signing_degree
= CRYPTO_DEGREE_PARTIAL
;
709 traverse_sessionid_stdout(state
,
710 server_id_str_buf(session
->pid
, &tmp
),
713 session_dialect_str(session
->connection_dialect
),
719 TALLOC_FREE(machine_hostname
);
720 TALLOC_FREE(tmp_ctx
);
726 static bool print_notify_rec_stdout(struct traverse_state
*state
,
730 unsigned subdir_filter
)
732 d_printf("%s\\%s\\%x\\%x\n", path
, server_id_str
,
733 filter
, subdir_filter
);
738 static int prepare_notify(struct traverse_state
*state
)
740 /* don't print header line */
745 static bool print_notify_rec(const char *path
, struct server_id server
,
746 const struct notify_instance
*instance
,
749 struct server_id_buf idbuf
;
750 struct traverse_state
*state
= (struct traverse_state
*)private_data
;
753 result
= print_notify_rec_stdout(state
,
755 server_id_str_buf(server
, &idbuf
),
756 (unsigned)instance
->filter
,
757 (unsigned)instance
->subdir_filter
);
763 OPT_RESOLVE_UIDS
= 1000,
766 int main(int argc
, const char *argv
[])
769 int profile_only
= 0;
770 bool show_processes
, show_locks
, show_shares
;
771 bool show_notify
= false;
772 poptContext pc
= NULL
;
773 struct traverse_state state
= {0};
774 struct poptOption long_options
[] = {
777 .longName
= "processes",
779 .argInfo
= POPT_ARG_NONE
,
782 .descrip
= "Show processes only",
785 .longName
= "verbose",
787 .argInfo
= POPT_ARG_NONE
,
790 .descrip
= "Be verbose",
795 .argInfo
= POPT_ARG_NONE
,
798 .descrip
= "Show locks only",
801 .longName
= "shares",
803 .argInfo
= POPT_ARG_NONE
,
806 .descrip
= "Show shares only",
809 .longName
= "notify",
811 .argInfo
= POPT_ARG_NONE
,
814 .descrip
= "Show notifies",
819 .argInfo
= POPT_ARG_STRING
,
822 .descrip
= "Switch to user",
827 .argInfo
= POPT_ARG_NONE
,
830 .descrip
= "Be brief",
833 .longName
= "profile",
835 .argInfo
= POPT_ARG_NONE
,
838 .descrip
= "Do profiling",
841 .longName
= "profile-rates",
843 .argInfo
= POPT_ARG_NONE
,
846 .descrip
= "Show call rates",
849 .longName
= "byterange",
851 .argInfo
= POPT_ARG_NONE
,
854 .descrip
= "Include byte range locks"
857 .longName
= "numeric",
859 .argInfo
= POPT_ARG_NONE
,
862 .descrip
= "Numeric uid/gid"
867 .argInfo
= POPT_ARG_NONE
,
870 .descrip
= "Skip checks if processes still exist"
873 .longName
= "resolve-uids",
875 .argInfo
= POPT_ARG_NONE
,
877 .val
= OPT_RESOLVE_UIDS
,
878 .descrip
= "Try to resolve UIDs to usernames"
884 TALLOC_CTX
*frame
= talloc_stackframe();
886 struct messaging_context
*msg_ctx
= NULL
;
891 state
.json_output
= false;
892 state
.resolve_uids
= false;
896 ok
= samba_cmdline_init(frame
,
897 SAMBA_CMDLINE_CONFIG_CLIENT
,
898 false /* require_smbconf */);
900 DBG_ERR("Failed to init cmdline parser!\n");
904 lp_set_cmdline("log level", "0");
906 pc
= samba_popt_get_context(getprogname(),
910 POPT_CONTEXT_KEEP_FIRST
);
912 DBG_ERR("Failed to setup popt context!\n");
917 while ((c
= poptGetNextOpt(pc
)) != -1) {
920 processes_only
= true;
938 Ucrit_addUid(nametouid(poptGetOptArg(pc
)));
953 case OPT_RESOLVE_UIDS
:
954 state
.resolve_uids
= true;
956 case POPT_ERROR_BADOPT
:
957 fprintf(stderr
, "\nInvalid option %s: %s\n\n",
958 poptBadOption(pc
, 0), poptStrerror(c
));
959 poptPrintUsage(pc
, stderr
, 0);
967 state
.root_json
= json_new_object();
968 #endif /* HAVE_JANSSON */
970 if (getuid() != geteuid()) {
971 fprintf(stderr
, "smbstatus should not be run setuid\n");
977 fprintf(stderr
, "smbstatus only works as root!\n");
982 /* setup the flags based on the possible combincations */
984 show_processes
= !(shares_only
|| locks_only
|| profile_only
) || processes_only
;
985 show_locks
= !(shares_only
|| processes_only
|| profile_only
) || locks_only
;
986 show_shares
= !(processes_only
|| locks_only
|| profile_only
) || shares_only
;
989 Ucrit_addUid( nametouid(username
) );
992 d_printf("using configfile = %s\n", get_dyn_CONFIGFILE());
995 msg_ctx
= cmdline_messaging_context(get_dyn_CONFIGFILE());
996 if (msg_ctx
== NULL
) {
997 fprintf(stderr
, "Could not initialize messaging, not root?\n");
1002 switch (profile_only
) {
1004 /* Dump profile data */
1005 ok
= status_profile_dump(verbose
);
1009 /* Continuously display rate-converted data */
1010 ok
= status_profile_rates(verbose
);
1017 if ( show_processes
) {
1018 prepare_sessionid(&state
);
1019 sessionid_traverse_read(traverse_sessionid
, &state
);
1021 if (processes_only
) {
1026 if ( show_shares
) {
1030 prepare_connections(&state
);
1031 connections_forall_read(traverse_connections
, &state
);
1035 if ( shares_only
) {
1042 struct db_context
*db
;
1044 db_path
= lock_path(talloc_tos(), "locking.tdb");
1045 if (db_path
== NULL
) {
1046 fprintf(stderr
, "Out of memory - exiting\n");
1051 db
= db_open(NULL
, db_path
, 0,
1052 TDB_CLEAR_IF_FIRST
|TDB_INCOMPATIBLE_HASH
, O_RDONLY
, 0,
1053 DBWRAP_LOCK_ORDER_1
, DBWRAP_FLAG_NONE
);
1056 fprintf(stderr
, "%s not initialised\n", db_path
);
1057 fprintf(stderr
, "This is normal if an SMB client has never "
1058 "connected to your server.\n");
1059 TALLOC_FREE(db_path
);
1063 TALLOC_FREE(db_path
);
1066 if (!locking_init_readonly()) {
1067 fprintf(stderr
, "Can't initialise locking module - exiting\n");
1072 prepare_share_mode(&state
);
1073 result
= share_entry_forall(print_share_mode
, &state
);
1076 fprintf(stderr
, "No locked files\n");
1077 } else if (result
< 0) {
1078 fprintf(stderr
, "locked file list truncated\n");
1084 prepare_brl(&state
);
1085 brl_forall(print_brl
, &state
);
1092 prepare_notify(&state
);
1093 notify_walk(msg_ctx
, print_notify_rec
, &state
);
1097 cmdline_messaging_context_free();
1098 poptFreeContext(pc
);