Package: samba
Version: 2:4.1.5+dfsg-1
Severity: minor
Tags: upstream patch
Dear Maintainer,
Process titles remain the same as the parent even though libbsd and
and setproctitle support are correctly detected during package build.
Additionally log.samba contains a number of ominous messages:
samba: setproctitle not initialized, please either call setproctitle_init() or
link against libbsd-ctor.
Attached patch completes the setproctitle support when using libbsd.
There may be a way to link libbsd-ctor.a and elminiate the extra defines,
but my wscript foo is lacking.
without attached patch:
24650 ? Ss 0:00 /usr/sbin/samba -D
24661 ? S 0:00 \_ /usr/sbin/samba -D
24663 ? Ss 0:00 | \_ /usr/sbin/smbd -D --option=server role
check:inhibit=yes --foreground
24715 ? S 0:00 | \_ /usr/sbin/smbd -D --option=server role
check:inhibit=yes --foreground
28724 ? S 0:00 | \_ /usr/sbin/smbd -D --option=server role
check:inhibit=yes --foreground
24662 ? S 0:00 \_ /usr/sbin/samba -D
24664 ? S 0:00 \_ /usr/sbin/samba -D
24665 ? S 0:00 \_ /usr/sbin/samba -D
24666 ? S 0:00 \_ /usr/sbin/samba -D
24667 ? S 0:00 \_ /usr/sbin/samba -D
24668 ? S 0:00 \_ /usr/sbin/samba -D
24669 ? S 0:00 \_ /usr/sbin/samba -D
24670 ? S 0:00 \_ /usr/sbin/samba -D
24671 ? S 0:00 \_ /usr/sbin/samba -D
24672 ? S 0:00 \_ /usr/sbin/samba -D
24673 ? S 0:00 \_ /usr/sbin/samba -D
24676 ? S 0:00 \_ /usr/sbin/samba -D
with attached patch:
9660 ? Ss 0:00 /usr/sbin/samba -D
9697 ? S 0:00 \_ samba: task[s3fs_parent]
9699 ? Ss 0:00 | \_ /usr/sbin/smbd -D --option=server role
check:inhibit=yes --foreground
10126 ? S 0:00 | \_ /usr/sbin/smbd -D --option=server role
check:inhibit=yes --foreground
9698 ? S 0:00 \_ samba: task[dcesrv]
9700 ? S 0:00 \_ samba: task[nbtd]
9701 ? S 0:00 \_ samba: task wrepl server_id[9701]
9702 ? S 0:00 \_ samba: task[ldapsrv]
9703 ? S 0:00 \_ samba: task[cldapd]
9704 ? S 0:00 \_ samba: task[kdc]
9706 ? S 0:00 \_ samba: task[dreplsrv]
9709 ? S 0:00 \_ samba: task[winbind]
9710 ? S 0:00 \_ samba: task[ntp_signd]
9714 ? S 0:00 \_ samba: task[kccsrv]
9715 ? S 0:00 \_ samba: task[dnsupdate]
9716 ? S 0:00 \_ samba: task[dns]
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -265,6 +265,8 @@
conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h')
if not conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h'):
conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h')
+ else:
+ conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h')
conf.CHECK_CODE('''
struct ucred cred;
--- a/lib/replace/replace.c
+++ b/lib/replace/replace.c
@@ -900,3 +900,8 @@
{
}
#endif
+#ifndef HAVE_SETPROCTITLE_INIT
+void rep_setproctitle_init(int argc, const char *argv[], char *envp[])
+{
+}
+#endif
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -898,5 +898,9 @@
#define setproctitle rep_setproctitle
void rep_setproctitle(const char *fmt, ...) PRINTF_ATTRIBUTE(1, 2);
#endif
+#ifndef HAVE_SETPROCTITLE_INIT
+#define setproctitle_init rep_setproctitle_init
+void rep_setproctitle_init(int argc, const char *argv[], char *envp[]);
+#endif
#endif /* _LIBREPLACE_REPLACE_H */
--- a/source4/smbd/server.c
+++ b/source4/smbd/server.c
@@ -509,7 +509,8 @@
return 0;
}
-int main(int argc, const char *argv[])
+int main(int argc, const char *argv[], const char *envp[])
{
+ setproctitle_init(argc, argv, envp);
return binary_smbd_main("samba", argc, argv);
}