smbstatus json/xml output with libxo

Stefan Metzmacher metze at
Wed Apr 17 14:55:44 UTC 2019

Hi Andrew,

> This weekend I had a small amount of free time and decided to add json/xml
> support to smbstatus. It's still very much a WIP, but thought it might be
> fun to share.
> root at S3:/usr/ports/net/samba410 # smbstatus --libxo json
> {"processes": {"Samba_version":"4.10.2", "session":
> [{"PID":"37213","Username":"awalker     ","Groupname":"awalker
> ","Machine":" (ipv4:
> )","Protocol":"SMB3_02","Encryption":"-","Signing":"-"}]}
> , "shares": {"connection":
> [{"Service":"share","pid":"37213","Machine":"","Connected
> at":"Mon Apr 15 09:36:10 2019 PDT","Encryption":"-","Signing":"-"}]}
> , "locks": {"sharemode":
> [{"Pid":"37213","User(ID)":1001,"DenyMode":"DENY_NONE","Access":"100081","RW":"RDONLY","Oplock:":"NONE","Path:":"/mnt/tank/samba","Name:":".","Time:":"Mon
> Apr 15 09:36:12 2019\n"}], "brl": []}
> }

I also thought about implementing json output for smbstatus.

We already use json (via libjansson) quite a lot, it got recently added
to some 'net ads' commands, see:;a=commitdiff;h=2e00ad44aa6822817f7e988cdfa7c87fc3aa5257

> XML:
> root at S3:/usr/ports/net/samba410 # smbstatus --libxo xml
> <processes><Samba_version>4.10.2</Samba_version><session><PID>37213</PID><Username>awalker
> </Username><Groupname>awalker     </Groupname><Machine> (ipv4:
> at>Mon Apr 15 09:36:10 2019 PDT</Connected
> at><Encryption>-</Encryption><Signing>-</Signing></connection></shares><locks><sharemode><Pid>37213</Pid><User(ID)>1001</User(ID)><DenyMode>DENY_NONE</DenyMode><Access>100081</Access><RW>RDONLY</RW><Oplock:>NONE</Oplock:><Path:>/mnt/tank/samba</Path:><Name:>.</Name:><Time:>Mon
> Apr 15 09:36:12 2019
> This is not exactly suitable for general consumption. If this (libxo
> support) is something that you all think would be useful to have in samba
> in general, I'm happy to work on it as I have free time.

I think using another library should be avoided, do you really need xml
or would you be able to work based on libjansson and only json?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the samba-technical mailing list