const struct share_mode_entry *e,
void *private_data)
{
+ bool resolve_uids = *((bool *)private_data);
static int count;
if (do_checks && !is_valid_share_mode_entry(e)) {
if (count==0) {
d_printf("Locked files:\n");
- d_printf("Pid Uid DenyMode Access R/W Oplock SharePath Name Time\n");
+ d_printf("Pid User(ID) DenyMode Access R/W Oplock SharePath Name Time\n");
d_printf("--------------------------------------------------------------------------------------------------\n");
}
count++;
if (Ucrit_checkPid(e->pid)) {
struct server_id_buf tmp;
d_printf("%-11s ", server_id_str_buf(e->pid, &tmp));
- d_printf("%-9u ", (unsigned int)e->uid);
+ if (resolve_uids) {
+ d_printf("%-14s ", uidtoname(e->uid));
+ } else {
+ d_printf("%-9u ", (unsigned int)e->uid);
+ }
switch (map_share_mode_to_deny_mode(e->share_access,
e->private_options)) {
case DENY_NONE: d_printf("DENY_NONE "); break;
return true;
}
+enum {
+ OPT_RESOLVE_UIDS = 1000,
+};
+
int main(int argc, const char *argv[])
{
int c;
int profile_only = 0;
bool show_processes, show_locks, show_shares;
bool show_notify = false;
+ bool resolve_uids = false;
poptContext pc;
struct poptOption long_options[] = {
POPT_AUTOHELP
.val = 'f',
.descrip = "Skip checks if processes still exist"
},
+ {
+ .longName = "resolve-uids",
+ .shortName = 0,
+ .argInfo = POPT_ARG_NONE,
+ .arg = NULL,
+ .val = OPT_RESOLVE_UIDS,
+ .descrip = "Try to resolve UIDs to usernames"
+ },
POPT_COMMON_SAMBA
POPT_TABLEEND
};
case 'f':
do_checks = false;
break;
+ case OPT_RESOLVE_UIDS:
+ resolve_uids = true;
+ break;
}
}
goto done;
}
- result = share_entry_forall(print_share_mode, NULL);
+ result = share_entry_forall(print_share_mode, &resolve_uids);
if (result == 0) {
d_printf("No locked files\n");