Code Monkey home page Code Monkey logo

ksmbd-tools's People

Contributors

alexmyczko avatar andy2244 avatar atheik avatar brainslayer avatar casta avatar database64128 avatar ddiss avatar edwardbetts avatar ematsumiya avatar gibeomii-kim avatar haythem-zd avatar hclee avatar lanph3re avatar lpapadakos avatar namjaejeon avatar neheb avatar pankajs01 avatar sergey-senozhatsky avatar slowfranklin avatar tymok avatar weihong6 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ksmbd-tools's Issues

startup error's on missing "[global]" and last LF in smb.cfg

ok i got the same "ERROR: Recv() error No error information" again and i found out why.
If [global] is missing or the last line has no LF, than this error happens.

this fails

[share]
	path = /mnt/sda
	valid users = andy
	guest ok = no

this works

[global]

[share]
	path = /mnt/sda
	valid users = andy
	guest ok = no

Similar if you forget a LF in the last line it will also fail.

NOTE: If it did succeeded once, you need to reset (rmmod) the kernel module again to see fails again, otherwise it seems to reuse some internal data. So after each smb.cfg change rmmod/modprobe to ensure proper testing. Thats why i could reproduce the error, when i encountered it the first time.

Segfault on accessing windows share properties menu.

Getting this if you use right click on the share and try to open the properties for it, from windows explorer.

cifsd -n
[cifsd-worker/14387]: DEBUG: treecon: net share permits guest login
[cifsd-worker/14387]: ERROR: Child received signal: 11 (Segmentation fault)
[cifsd-worker/14387]: ERROR: Recv() error Bad file descriptor
[cifsd-manager/14386]: ERROR: WARNING: child process exited abnormally: 14387

"Access is denied." errors while trying to run binarys from share.

I use F2FS as filesystem on the share and while i can run scriptfiles directly from the share any executable binary refuses to start with "Access is denied.". The files/folders on the share are all set to 0777 access.

Is this a FS problem, since the mapped share actually reports "F2FS" via share/properties on Windows 10, while via samba3/4 it was always reported as NTFS, no matter what the actual FS was.

Start.exe
Access is denied.

Yet i can edit/open the file via hexeditor just fine, so i have at least read, write access.

So is this a know limitation currently, do i miss some parameter or what can i try to get binarys working directly from the share?

How can i build it for android?

I want use this project in android as cifs server,could you tell me how can i build it for andorid ? Thank you very much!

Can't open PID file /run/ksmbd.lock (yet?)

Does everyone else noticed this error message? I am using the most recent version of ksmbd-tools 3.4.9

ksmbd.service: Can't open PID file /run/ksmbd.lock (yet?) after start: Operation not permitted

I found an issue on the systemd github page: systemd/systemd#16636
But as explained there, it seems to be an application issue not a systemd problem.

ksmbd.service.in

Hi, I think line 3 in ksmbd.service.in is not right, it should probably read
Requires=modprobe ksmbd

cifsd: Netlink error in ipc_process_event()

On openWRT i get those netlink errors, while trying to start cifsd, they happen in ipc_process_event()

I checked the socket *sk and the return value of nl_recvmsgs_default()
The socket itself seems to-be ok, its not NULL and i can get a fd via nl_socket_get_fd(sk).
Yet i get a -7 return code from nl_recvmsgs_default().

NLDBG=3 cifsd -n
[cifsd-worker/11117]: ERROR: Sockert FD is < 4 >
[cifsd-worker/11117]: ERROR: Recv() error No error information, netlink error < -7 > Invalid input data or parameter
[cifsd-worker/11117]: DEBUG: Kill share ipc$
[cifsd-worker/11117]: DEBUG: Kill user andy

Any ideas on this one and is there a way to debug the sk* and msg better, since i get nothing via NLDBG?

add the ability to listen in on certain network addresses

Would it be possible to implement an option to listen only on certain networks of an interface. this is particularly useful for IPV6. i have a ULA network and a GUA network. I'd like ksmbd to listen only on my ULA network fd42:d1d2:cafe:cafe::/64 and not on my GUA ip 2001:db8:cafe:cafe::/64 and be accessible to the whole internet. in the meantime I'm going to use firewaling, but it would be useful if it were natively supported by ksmbd :)

Thanks !

Crashes with a Windows 10 client

Hello,

I upgraded my Windows client from Windows 7 to Windows 10, trying to run the same task as before (Windows Backup to the network share), but the ksmb server now crashes:

[Wed Jan  7 18:20:44 1970] ksmbd: sock_read failed: -11
[Wed Jan  7 18:20:44 1970] 8<--- cut here ---
[Wed Jan  7 18:20:44 1970] Unable to handle kernel NULL pointer dereference at virtual address 00000010
[Wed Jan  7 18:20:44 1970] [00000010] *pgd=80000040204003, *pmd=00000000
[Wed Jan  7 18:20:44 1970] Internal error: Oops: 206 [#1] SMP ARM
[Wed Jan  7 18:20:44 1970] Modules linked in: cmac sha512_generic sha512_arm nls_utf8 ksmbd crc32_generic cifs_arc4 sit tunnel4 ip_tunnel xt_comment xt_multiport xt_limit xt_length xt_tcpudp xt_CT ip6t_rpfilter ipt_rpfilter ip6table_nat ip6table_raw ip6table_mangle iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 iptable_raw iptable_mangle nf_tables nfnetlink ip6table_filter ip6_tables iptable_filter ip_tables x_tables cpufreq_userspace cpufreq_powersave cpufreq_ondemand cpufreq_conservative tcp_bbr dm_crypt dm_mod ecb des_generic evdev aes_arm_bs crypto_simd cryptd axp20x_adc axp20x_pek industrialio sun4i_backend lima gpu_sched drm_shmem_helper r8188eu(C) sunxi_cir nvmem_sunxi_sid sunxi_wdt rc_core sun4i_ts libarc4 sunxi_cedrus(C) v4l2_mem2mem videobuf2_dma_contig sg videobuf2_memops videobuf2_v4l2 sun4i_ss videobuf2_common videodev libdes mc leds_gpio cpufreq_dt ext4 crc16 mbcache jbd2 btrfs blake2b_neon blake2b_generic xor xor_neon raid6_pq zstd_compress libcrc32c crc32c_generic sd_mod
[Wed Jan  7 18:20:44 1970]  t10_pi crc64_rocksoft crc64 crc_t10dif crct10dif_generic crct10dif_common axp20x_regulator ahci_sunxi libahci_platform dwmac_sunxi libahci stmmac_platform stmmac pcs_xpcs phylink of_mdio fixed_phy fwnode_mdio libata libphy sun4i_frontend drm_dma_helper ptp sun4i_tcon sun8i_tcon_top pps_core i2c_mv64xxx ohci_platform ehci_platform ohci_hcd scsi_mod ehci_hcd drm_kms_helper usbcore scsi_common drm sunxi_mmc phy_sun4i_usb
[Wed Jan  7 18:20:44 1970] CPU: 1 PID: 120 Comm: kworker/1:2 Tainted: G         C         6.1.0-0.deb11.6-armmp-lpae #1  Debian 6.1.15-1~bpo11+1
[Wed Jan  7 18:20:44 1970] Hardware name: Allwinner sun7i (A20) Family
[Wed Jan  7 18:20:44 1970] Workqueue: ksmbd-io __smb2_oplock_break_noti [ksmbd]
[Wed Jan  7 18:20:44 1970] PC is at apparmor_socket_sendmsg+0x18/0x20
[Wed Jan  7 18:20:44 1970] LR is at security_socket_sendmsg+0x40/0x5c
[Wed Jan  7 18:20:44 1970] pc : [<c080410c>]    lr : [<c07b69ac>]    psr: a0070013
[Wed Jan  7 18:20:44 1970] sp : f08f1e20  ip : 0000005c  fp : ff7f3005
[Wed Jan  7 18:20:44 1970] r10: c2698000  r9 : d077a100  r8 : 00000001
[Wed Jan  7 18:20:44 1970] r7 : 00000000  r6 : f08f1e50  r5 : 0000005c  r4 : c1300160
[Wed Jan  7 18:20:44 1970] r3 : 00000000  r2 : 0000005c  r1 : 00000002  r0 : c12e9234
[Wed Jan  7 18:20:44 1970] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[Wed Jan  7 18:20:44 1970] Control: 30c5387d  Table: 5148d080  DAC: fed4d90d
[Wed Jan  7 18:20:44 1970] Register r0 information: non-slab/vmalloc memory
[Wed Jan  7 18:20:44 1970] Register r1 information: non-paged memory
[Wed Jan  7 18:20:44 1970] Register r2 information: non-paged memory
[Wed Jan  7 18:20:44 1970] Register r3 information: NULL pointer
[Wed Jan  7 18:20:44 1970] Register r4 information: non-slab/vmalloc memory
[Wed Jan  7 18:20:44 1970] Register r5 information: non-paged memory
[Wed Jan  7 18:20:44 1970] Register r6 information: 2-page vmalloc region starting at 0xf08f0000 allocated at kernel_clone+0x9c/0x374
[Wed Jan  7 18:20:44 1970] Register r7 information: NULL pointer
[Wed Jan  7 18:20:44 1970] Register r8 information: non-paged memory
[Wed Jan  7 18:20:44 1970] Register r9 information: slab kmalloc-64 start d077a100 pointer offset 0 size 64
[Wed Jan  7 18:20:44 1970] Register r10 information: slab task_struct start c2698000 pointer offset 0
[Wed Jan  7 18:20:44 1970] Register r11 information: 0-page vmalloc region starting at 0xff7dc000 allocated at pcpu_get_vm_areas+0x0/0x1168
[Wed Jan  7 18:20:44 1970] Register r12 information: non-paged memory
[Wed Jan  7 18:20:44 1970] Process kworker/1:2 (pid: 120, stack limit = 0xb18a409d)
[Wed Jan  7 18:20:44 1970] Stack: (0xf08f1e20 to 0xf08f2000)
[Wed Jan  7 18:20:44 1970] 1e20: f08f1e50 00000000 d1efb480 0000005c 00000001 c0bd73a4 f08f1ec4 00000001
[Wed Jan  7 18:20:44 1970] 1e40: d1efb480 bf816060 0000005c ef6ac500 00000000 00000000 00000000 00000000
[Wed Jan  7 18:20:44 1970] 1e60: 00010001 00000000 0000005c f08f1ec4 00000001 00000000 00000000 00000000
[Wed Jan  7 18:20:44 1970] 1e80: 00004000 00000000 00000000 00000000 00000000 00000000 c2698000 d5739a39
[Wed Jan  7 18:20:44 1970] 1ea0: c3c52210 bf816000 0000005c c3c52200 c3c52210 bf81264c 00000000 00000000
[Wed Jan  7 18:20:44 1970] 1ec0: bf80fbb0 c3a66000 0000005c bf834d44 0000003a c24958a4 c3c52200 d5739a39
[Wed Jan  7 18:20:44 1970] 1ee0: c3a66000 c3c52200 d0fbe200 c24958a4 c2495840 bf80fc9c d0d6b604 d0a38200
[Wed Jan  7 18:20:44 1970] 1f00: 2e17e000 c152e4c0 00000000 c24958a4 c279ac80 ef6ac180 ff7f3000 00000000
[Wed Jan  7 18:20:44 1970] 1f20: 00000040 c0467798 c2698000 c2698000 ef6ac180 ef6ac180 ef6ac19c c279ac80
[Wed Jan  7 18:20:44 1970] 1f40: ef6ac180 c279ac98 ef6ac19c c1604d40 00000008 c2698000 ef6ac180 c0467ed8
[Wed Jan  7 18:20:44 1970] 1f60: c279ac80 c1789825 f0871ecc c27fa8c0 c2698000 c0467e7c c279ac80 c3824cc0
[Wed Jan  7 18:20:44 1970] 1f80: f0871ecc 00000000 00000000 c046f90c c27fa8c0 c046f834 00000000 00000000
[Wed Jan  7 18:20:44 1970] 1fa0: 00000000 00000000 00000000 c0400160 00000000 00000000 00000000 00000000
[Wed Jan  7 18:20:44 1970] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[Wed Jan  7 18:20:44 1970] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[Wed Jan  7 18:20:44 1970]  apparmor_socket_sendmsg from security_socket_sendmsg+0x40/0x5c
[Wed Jan  7 18:20:44 1970]  security_socket_sendmsg from sock_sendmsg+0x1c/0x4c
[Wed Jan  7 18:20:44 1970]  sock_sendmsg from ksmbd_tcp_writev+0x60/0x88 [ksmbd]
[Wed Jan  7 18:20:44 1970]  ksmbd_tcp_writev [ksmbd] from ksmbd_conn_write+0xb8/0x19c [ksmbd]
[Wed Jan  7 18:20:44 1970]  ksmbd_conn_write [ksmbd] from __smb2_oplock_break_noti+0x138/0x1ec [ksmbd]
[Wed Jan  7 18:20:44 1970]  __smb2_oplock_break_noti [ksmbd] from process_one_work+0x1f4/0x4bc
[Wed Jan  7 18:20:44 1970]  process_one_work from worker_thread+0x5c/0x50c
[Wed Jan  7 18:20:44 1970]  worker_thread from kthread+0xd8/0xf4
[Wed Jan  7 18:20:44 1970]  kthread from ret_from_fork+0x14/0x34
[Wed Jan  7 18:20:44 1970] Exception stack(0xf08f1fb0 to 0xf08f1ff8)
[Wed Jan  7 18:20:44 1970] 1fa0:                                     00000000 00000000 00000000 00000000
[Wed Jan  7 18:20:44 1970] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[Wed Jan  7 18:20:44 1970] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[Wed Jan  7 18:20:44 1970] Code: e1a03000 e3a01002 e3090234 e34c012e (e5932010) 
[Wed Jan  7 18:20:44 1970] ---[ end trace 0000000000000000 ]---

uid to windows SID mapping support

Hi,

uid to windows SID mapping is used when

  • show acl in windows client
  • change ACL from windows client

test result show that there are same issues about this feature.

Folders/Files are not fully deleted via explorer on mounted share.

I just tried to delete my test portableapps folder and noticed that's not possible. I tried delete via explorer on my top-folder and some files/folders will remain. They are also still visible via sftp, so its not some caching issue on windows.

root@router:/mnt/sda/2# ls -RA
.:
PortableApps

./PortableApps:
.nomedia         FirefoxPortable

./PortableApps/FirefoxPortable:
Data

./PortableApps/FirefoxPortable/Data:
profile

./PortableApps/FirefoxPortable/Data/profile:
storage

./PortableApps/FirefoxPortable/Data/profile/storage:
permanent

./PortableApps/FirefoxPortable/Data/profile/storage/permanent:
chrome

./PortableApps/FirefoxPortable/Data/profile/storage/permanent/chrome:
.metadata     .metadata-v2

Segmentation fault while trying to browse host from Win10 explorer.

I keep getting segfaults, while trying to access anything higher than the share itself.

[global]
	netbios name = cifsd
	map to guest = Bad User

[share]
	path = /mnt/sda
	read only = no
	guest ok = yes

If i try to access \\router\share directly all works, yet if i try \\router. \\router\ or \\192.168.1.1\ i get the segfaults below.

cifsd -n
[cifsd-worker/14791]: DEBUG: treecon: net share permits guest login
[cifsd-worker/14791]: ERROR: Child received signal: 11 (Segmentation fault)
[cifsd-worker/14791]: ERROR: Recv() error Bad file descriptor, netlink error < -3 > Bad socket
[cifsd-manager/14790]: ERROR: WARNING: child process exited abnormally: 14791
[cifsd-worker/14795]: ERROR: Child received signal: 11 (Segmentation fault)
[cifsd-worker/14795]: ERROR: Recv() error Bad file descriptor, netlink error < -3 > Bad socket
[cifsd-manager/14790]: ERROR: WARNING: child process exited abnormally: 14795
[cifsd-worker/14797]: ERROR: Child received signal: 11 (Segmentation fault)
[cifsd-worker/14797]: ERROR: Recv() error Bad file descriptor, netlink error < -3 > Bad socket
[cifsd-manager/14790]: ERROR: WARNING: child process exited abnormally: 14797
[cifsd-worker/14799]: ERROR: RPC: unknown pipe ID: 0
[cifsd-worker/14799]: ERROR: Child received signal: 11 (Segmentation fault)
[cifsd-worker/14799]: ERROR: Recv() error Bad file descriptor, netlink error < -3 > Bad socket
[cifsd-manager/14790]: ERROR: WARNING: child process exited abnormally: 14799
[cifsd-worker/14801]: ERROR: Child received signal: 11 (Segmentation fault)
[cifsd-worker/14801]: ERROR: Recv() error Bad file descriptor, netlink error < -3 > Bad socket
[cifsd-manager/14790]: ERROR: WARNING: child process exited abnormally: 14801

"hosts allow" does not work?

Hello,

In ksmbd-tools 3.4.5, with a config like this:

[test]
path = /mnt/p3/test/
hosts allow = 127.0.0.1 fd39::/64

Starting ksmbd leads to messages:

# ksmbd.mountd -n
[ksmbd-worker/5983]: INFO: Drop non-existing user `127.0.0.1'
[ksmbd-worker/5983]: INFO: Drop non-existing user `fd39::/64'

Same with "hosts deny".

I have not checked if the allow/deny behavior is actually enforced, the log messages suggest a config parse error.

Is it something fixed in a later version? I checked the commit history briefly, and did not notice anything similar.

How obtain RW access

My /etc/cifs/smb.conf

[global]
        netbios name = BUILD

[homes]
        comment = content server share
        path = /tmp
        valid users = user1

[share]
        comment = my share
        path = /share
        valid users = user1

permission on shared folder 777:

root@build:~# ls -al /share/
total 8
drwxrwxrwx  2 root root 4096 Jul 28 08:19 .
drwxr-xr-x 24 root root 4096 Jul 28 08:19 ..

But when im try to create some file in share
i'm obtain: you need permission to perform this action

In debug cifsadmin -D 1 it shows:
kcifsd: smb2_open:2614: returning as user does not have permission to write

Full log:

[ 2824.572058] kcifsd: cifsd_tcp_conn_handler_loop:217: RFC1002 header 192 bytes
[ 2824.573486] kcifsd: check_smb_message:131: got SMB2 command
[ 2824.574865] kcifsd: smb2_open:2324: [smb2_open] 6
[ 2824.576304] kcifsd: smb2_open:2336: converted name = /share
[ 2824.576916] kcifsd: check_context_err:2215: find context ExtA err -2
[ 2824.577552] kcifsd: smb2_open:2464: get query maximal access context (timestamp : 0)
[ 2824.578159] kcifsd: check_context_err:2215: find context TWrp err -2
[ 2824.578768] kcifsd: smb2_open:2699: volatile_id returned: 3
[ 2824.579428] kcifsd: cifsd_insert_in_global_table:752: persistent_id allocated 3
[ 2824.579431] kcifsd: check_context_err:2215: find context AlSi err -2
[ 2824.580697] kcifsd: check_context_err:2215: find context QFid err -2
[ 2824.581296] kcifsd: smb2_set_rsp_credits:615: credits: requested[1] granted[1] total_granted[30]
[ 2824.582239] kcifsd: cifsd_tcp_conn_handler_loop:217: RFC1002 header 104 bytes
[ 2824.582842] kcifsd: check_smb_message:131: got SMB2 command
[ 2824.583504] kcifsd: smb2_query_info:4622: GOT query info request
[ 2824.584148] kcifsd: smb2_query_info:4636: GOT SMB2_O_INFO_FILESYSTEM
[ 2824.584749] kcifsd: smb2_set_rsp_credits:615: credits: requested[1] granted[1] total_granted[30]
[ 2824.585614] kcifsd: cifsd_tcp_conn_handler_loop:217: RFC1002 header 88 bytes
[ 2824.586234] kcifsd: check_smb_message:131: got SMB2 command
[ 2824.586840] kcifsd: smb2_close:4808: volatile_id = 3 persistent_id = 3
[ 2824.587523] kcifsd: smb2_set_rsp_credits:615: credits: requested[1] granted[1] total_granted[30]
[ 2824.588591] kcifsd: cifsd_tcp_conn_handler_loop:217: RFC1002 header 68 bytes
[ 2824.589230] kcifsd: check_smb_message:131: got SMB2 command
[ 2824.589849] kcifsd: smb2_get_cifsd_tcon:157: skip to check tree connect request
[ 2824.590479] kcifsd: smb2_cancel:5993: smb2 cancel called on mid 0
[ 2824.632037] kcifsd: cifsd_tcp_conn_handler_loop:217: RFC1002 header 192 bytes
[ 2824.632813] kcifsd: check_smb_message:131: got SMB2 command
[ 2824.633598] kcifsd: smb2_open:2324: [smb2_open] 6
[ 2824.634340] kcifsd: smb2_open:2336: converted name = /share
[ 2824.635050] kcifsd: check_context_err:2215: find context ExtA err -2
[ 2824.635834] kcifsd: smb2_open:2464: get query maximal access context (timestamp : 0)
[ 2824.636643] kcifsd: check_context_err:2215: find context TWrp err -2
[ 2824.637388] kcifsd: smb2_open:2699: volatile_id returned: 3
[ 2824.638108] kcifsd: cifsd_insert_in_global_table:752: persistent_id allocated 3
[ 2824.638111] kcifsd: check_context_err:2215: find context AlSi err -2
[ 2824.639591] kcifsd: check_context_err:2215: find context QFid err -2
[ 2824.640337] kcifsd: smb2_set_rsp_credits:615: credits: requested[1] granted[1] total_granted[29]
[ 2824.641394] kcifsd: cifsd_tcp_conn_handler_loop:217: RFC1002 header 88 bytes
[ 2824.642124] kcifsd: check_smb_message:131: got SMB2 command
[ 2824.642832] kcifsd: smb2_close:4808: volatile_id = 3 persistent_id = 3
[ 2824.643628] kcifsd: smb2_set_rsp_credits:615: credits: requested[1] granted[1] total_granted[29]
[ 2824.645098] kcifsd: cifsd_tcp_conn_handler_loop:217: RFC1002 header 256 bytes
[ 2824.645829] kcifsd: check_smb_message:131: got SMB2 command
[ 2824.646576] kcifsd: convert_to_unix_name:3536: new_name len = 28
[ 2824.647362] kcifsd: smb2_get_name:750: absoulte name = /share/New Text Document.txt
[ 2824.648131] kcifsd: smb2_open:2336: converted name = /share/New Text Document.txt
[ 2824.648850] kcifsd: check_context_err:2215: find context ExtA err -2
[ 2824.649598] kcifsd: smb2_open:2464: get query maximal access context (timestamp : 1125968626319360)
[ 2824.651061] kcifsd: check_context_err:2215: find context TWrp err -2
[ 2824.651826] kcifsd: smb2_open:2501: can not get linux path for /share/New Text Document.txt, rc = -2
[ 2824.653207] kcifsd: smb2_open:2614: returning as user does not have permission to write
[ 2824.653869] kcifsd: smb2_set_rsp_credits:615: credits: requested[1] granted[1] total_granted[29]
[ 2824.654913] kcifsd: cifsd_tcp_conn_handler_loop:217: RFC1002 header 256 bytes
[ 2824.655607] kcifsd: check_smb_message:131: got SMB2 command
[ 2824.656313] kcifsd: convert_to_unix_name:3536: new_name len = 28
[ 2824.656966] kcifsd: smb2_get_name:750: absoulte name = /share/New Text Document.txt
[ 2824.657633] kcifsd: smb2_open:2336: converted name = /share/New Text Document.txt
[ 2824.658301] kcifsd: check_context_err:2215: find context ExtA err -2
[ 2824.658951] kcifsd: smb2_open:2464: get query maximal access context (timestamp : 1125968626319360)
[ 2824.660341] kcifsd: check_context_err:2215: find context TWrp err -2
[ 2824.661046] kcifsd: smb2_open:2501: can not get linux path for /share/New Text Document.txt, rc = -2
[ 2824.662453] kcifsd: smb2_open:2614: returning as user does not have permission to write
[ 2824.663223] kcifsd: smb2_set_rsp_credits:615: credits: requested[1] granted[1] total_granted[29]
[ 2824.664326] kcifsd: cifsd_tcp_conn_handler_loop:217: RFC1002 header 256 bytes
[ 2824.665051] kcifsd: check_smb_message:131: got SMB2 command
[ 2824.665792] kcifsd: convert_to_unix_name:3536: new_name len = 28
[ 2824.666530] kcifsd: smb2_get_name:750: absoulte name = /share/New Text Document.txt
[ 2824.667293] kcifsd: smb2_open:2336: converted name = /share/New Text Document.txt
[ 2824.668083] kcifsd: check_context_err:2215: find context ExtA err -2
[ 2824.668804] kcifsd: smb2_open:2464: get query maximal access context (timestamp : 1125968626319360)
[ 2824.670293] kcifsd: check_context_err:2215: find context TWrp err -2
[ 2824.671057] kcifsd: smb2_open:2501: can not get linux path for /share/New Text Document.txt, rc = -2
[ 2824.672599] kcifsd: smb2_open:2614: returning as user does not have permission to write
[ 2824.673421] kcifsd: smb2_set_rsp_credits:615: credits: requested[1] granted[1] total_granted[29]
[ 2824.674704] kcifsd: cifsd_tcp_conn_handler_loop:217: RFC1002 header 256 bytes
[ 2824.675511] kcifsd: check_smb_message:131: got SMB2 command
[ 2824.676306] kcifsd: convert_to_unix_name:3536: new_name len = 28
[ 2824.677058] kcifsd: smb2_get_name:750: absoulte name = /share/New Text Document.txt
[ 2824.677825] kcifsd: smb2_open:2336: converted name = /share/New Text Document.txt
[ 2824.678583] kcifsd: check_context_err:2215: find context ExtA err -2
[ 2824.679385] kcifsd: smb2_open:2464: get query maximal access context (timestamp : 1125968626319360)
[ 2824.680889] kcifsd: check_context_err:2215: find context TWrp err -2
[ 2824.681682] kcifsd: smb2_open:2501: can not get linux path for /share/New Text Document.txt, rc = -2
[ 2824.683238] kcifsd: smb2_open:2614: returning as user does not have permission to write
[ 2824.683995] kcifsd: smb2_set_rsp_credits:615: credits: requested[1] granted[1] total_granted[29]
[ 2824.685214] kcifsd: cifsd_tcp_conn_handler_loop:217: RFC1002 header 120 bytes
[ 2824.685986] kcifsd: check_smb_message:131: got SMB2 command
[ 2824.686788] kcifsd: smb2_ioctl:6740: not implemented yet ioctl command 0x900a8
[ 2824.687726] kcifsd: smb2_set_rsp_credits:615: credits: requested[1] granted[1] total_granted[29]
[ 2824.690848] kcifsd: cifsd_tcp_conn_handler_loop:217: RFC1002 header 104 bytes
[ 2824.691665] kcifsd: check_smb_message:131: got SMB2 command
[ 2824.692453] kcifsd: smb2_query_info:4622: GOT query info request
[ 2824.693259] kcifsd: smb2_query_info:4636: GOT SMB2_O_INFO_FILESYSTEM
[ 2824.694031] kcifsd: smb2_set_rsp_credits:615: credits: requested[1] granted[1] total_granted[29]
[ 2824.695815] kcifsd: cifsd_tcp_conn_handler_loop:217: RFC1002 header 104 bytes
[ 2824.696588] kcifsd: check_smb_message:131: got SMB2 command
[ 2824.697332] kcifsd: smb2_query_info:4622: GOT query info request
[ 2824.698044] kcifsd: smb2_query_info:4636: GOT SMB2_O_INFO_FILESYSTEM
[ 2824.698776] kcifsd: smb2_set_rsp_credits:615: credits: requested[1] granted[1] total_granted[29]
[ 2826.014668] kcifsd: cifsd_tcp_conn_handler_loop:217: RFC1002 header 288 bytes
[ 2826.015606] kcifsd: check_smb_message:131: got SMB2 command
[ 2826.016574] kcifsd: smb2_open:2324: [smb2_open] 6
[ 2826.017360] kcifsd: smb2_open:2336: converted name = /share
[ 2826.018053] kcifsd: check_context_err:2215: find context ExtA err -2
[ 2826.018753] kcifsd: smb2_open:2464: get query maximal access context (timestamp : 281750966981630)
[ 2826.020208] kcifsd: check_context_err:2215: find context TWrp err -2
[ 2826.020944] kcifsd: smb2_open:2699: volatile_id returned: 3
[ 2826.021633] kcifsd: cifsd_insert_in_global_table:752: persistent_id allocated 3
[ 2826.021635] kcifsd: check_context_err:2215: find context AlSi err -2
[ 2826.022984] kcifsd: check_context_err:2215: find context QFid err -2
[ 2826.023706] kcifsd: is_chained_smb2_message:453: got SMB2 chained command
[ 2826.024431] kcifsd: init_chained_smb2_rsp:405: Compound req new_len = 184 rcv off = 192 rsp off = 184
[ 2826.025762] kcifsd: is_chained_smb2_message:464: padding len 7
[ 2826.026437] kcifsd: smb2_set_rsp_credits:615: credits: requested[1] granted[1] total_granted[29]
[ 2826.027842] kcifsd: cifsd_tcp_conn_handler_loop:217: RFC1002 header 96 bytes
[ 2826.028596] kcifsd: check_smb_message:131: got SMB2 command
[ 2826.029418] kcifsd: smb2_send_interim_resp:797: Send interim Response to inform asynchronous request id : 28
[ 2826.090731] kcifsd: cifsd_tcp_conn_handler_loop:217: RFC1002 header 192 bytes
[ 2826.091589] kcifsd: check_smb_message:131: got SMB2 command
[ 2826.092278] kcifsd: smb2_open:2324: [smb2_open] 6
[ 2826.092919] kcifsd: smb2_open:2336: converted name = /share
[ 2826.093598] kcifsd: check_context_err:2215: find context ExtA err -2
[ 2826.094333] kcifsd: smb2_open:2464: get query maximal access context (timestamp : 0)
[ 2826.094965] kcifsd: check_context_err:2215: find context TWrp err -2
[ 2826.095684] kcifsd: smb2_open:2699: volatile_id returned: 4
[ 2826.096370] kcifsd: cifsd_insert_in_global_table:752: persistent_id allocated 4
[ 2826.096373] kcifsd: check_context_err:2215: find context AlSi err -2
[ 2826.097702] kcifsd: check_context_err:2215: find context QFid err -2
[ 2826.098337] kcifsd: smb2_set_rsp_credits:615: credits: requested[1] granted[1] total_granted[27]
[ 2826.099438] kcifsd: cifsd_tcp_conn_handler_loop:217: RFC1002 header 192 bytes
[ 2826.100105] kcifsd: check_smb_message:131: got SMB2 command
[ 2826.100763] kcifsd: smb2_open:2324: [smb2_open] 6
[ 2826.101407] kcifsd: smb2_open:2336: converted name = /share
[ 2826.102022] kcifsd: check_context_err:2215: find context ExtA err -2
[ 2826.102650] kcifsd: smb2_open:2464: get query maximal access context (timestamp : 0)
[ 2826.103345] kcifsd: check_context_err:2215: find context TWrp err -2
[ 2826.103991] kcifsd: smb2_open:2699: volatile_id returned: 5
[ 2826.104638] kcifsd: cifsd_insert_in_global_table:752: persistent_id allocated 5
[ 2826.104640] kcifsd: check_context_err:2215: find context AlSi err -2
[ 2826.105898] kcifsd: check_context_err:2215: find context QFid err -2
[ 2826.106524] kcifsd: smb2_set_rsp_credits:615: credits: requested[1] granted[1] total_granted[27]
[ 2826.107475] kcifsd: cifsd_tcp_conn_handler_loop:217: RFC1002 header 202 bytes
[ 2826.108122] kcifsd: check_smb_message:131: got SMB2 command
[ 2826.108783] kcifsd: smb2_query_dir:3397: Search pattern is *
[ 2826.109420] kcifsd: smb2_query_dir:3415: Directory name is /share
[ 2826.110039] kcifsd: smb2_populate_readdir_entry:3317: info_level : 37, buf_len :65347, next_offset : 112, data_count : 112
[ 2826.111385] kcifsd: smb2_populate_readdir_entry:3317: info_level : 37, buf_len :65235, next_offset : 112, data_count : 224
[ 2826.112735] kcifsd: is_chained_smb2_message:453: got SMB2 chained command
[ 2826.113378] kcifsd: init_chained_smb2_rsp:405: Compound req new_len = 296 rcv off = 104 rsp off = 296
[ 2826.114649] kcifsd: smb2_query_dir:3397: Search pattern is *
[ 2826.115338] kcifsd: smb2_query_dir:3415: Directory name is /share
[ 2826.115961] kcifsd: is_chained_smb2_message:464: padding len 7
[ 2826.116599] kcifsd: smb2_set_rsp_credits:615: credits: requested[1] granted[1] total_granted[27]
[ 2826.117646] kcifsd: cifsd_tcp_conn_handler_loop:217: RFC1002 header 88 bytes
[ 2826.118308] kcifsd: check_smb_message:131: got SMB2 command
[ 2826.118955] kcifsd: smb2_close:4808: volatile_id = 4 persistent_id = 4
[ 2826.119696] kcifsd: smb2_set_rsp_credits:615: credits: requested[1] granted[1] total_granted[27]
[ 2826.120572] kcifsd: cifsd_tcp_conn_handler_loop:217: RFC1002 header 88 bytes
[ 2826.121253] kcifsd: check_smb_message:131: got SMB2 command
[ 2826.121903] kcifsd: smb2_close:4808: volatile_id = 5 persistent_id = 5
[ 2826.122563] kcifsd: smb2_set_rsp_credits:615: credits: requested[1] granted[1] total_granted[27]

Cifsd kernel server keeps serving files, even if the cifsd userspace service stopped.

I just encountered the case were the cifsd userspace service did end, was killed, yet the share was still accessible. I would like to ensure that if we end, kill the userspace service that the shares become inaccessible and we can remove the kernel module. So some option for the userspace tools to force the kernel module to end and allow removal.

Atm after this happens i cant remove the module anymore:

rmmod cifsd
unloading the module failed

windows domain(ads) support

Hi,

I successed to build ksmbd-tools 3.4.6 with
LIBKRB5_CFLAGS="$(/usr/bin/krb5-config krb5 --cflags)"
LIBKRB5_LIBS="$(/usr/bin/krb5-config krb5 --libs)"
--enable-krb5

do we have a test command inside ksmbd-tools to test krb5 user/password, and then output
the user/group id assigned by windows ads/linux?

Best regards

ksmbd.adduser should check the username already in /etc/passwd

Hi,

I created a user USER_A with ksmbd.adduser, login through windows 10 client,
and then create a file FILE_A on the backend filesystem ext4/btrfs from windows 10 client.

How the the uid/gid of the FILE_A is decided? Can we use the uid/gid of /etc/passwd file?

Best Regards

Symlink in share path hinders total and free disk space reporting to Windows [updated]

Hello,

In Debian with
ksmbd-tools 3.4.5-1~bpo11+1
kernel 6.1.0-3-armmp-lpae

Mapping a network drive in Windows and opening the drive properties, the total and available disk space are both shown as 0 bytes: https://romanrm.net/2023-02-21T221301Z-ksmbd.png

Meanwhile "ksmbd.mountd -n" prints on the console:

[ksmbd-worker/22585]: ERROR: Unsupported share info level (write): 2
[ksmbd-worker/22585]: ERROR: Unsupported share info level (read): 2

Lacking support for reporting free disk space really limits the usability of ksmbd. For instance such a share is not suitable as a destination for Windows built-in backup. And I cannot even verify if there is a performance improvement compared to Samba, because CrystalDiskMark refuses to operate on the ksmbd share, citing not enough free disk space. So I hope you could consider adding this feature.

Thanks!

Assertion failed: 0 (lib/socket.c) ?

Just got this one, which seems new.

 cifsd -n
[cifsd-worker/32287]: ERROR: Can't open `/etc/cifs/cifsdpwd.db': No such file or directory
[cifsd-worker/32287]: ERROR: User database file does not exist. Only guest sessions (if permitted) will work.
[cifsd-worker/32287]: ERROR: Unsupported share info level (write): 2
[cifsd-worker/32287]: ERROR: Unsupported share info level (read): 2
[cifsd-worker/32287]: ERROR: SRVSVC: unsupported INVOKE method 21
^C[cifsd-worker/32287]: ERROR: Child received signal: 2 (Interrupt)
[cifsd-worker/32287]: ERROR: Child received signal: 2 (Interrupt)
BUG at file position lib/socket.c:134:release_local_port
Assertion failed: 0 (lib/socket.c: release_local_port: 134)
[cifsd-manager/32286]: INFO: Exiting. Bye!

KSMBD_DCERPC_RETURN_READY should be cleared if the return isn't ready

rpc_write_request() always sets

dce->flags |= KSMBD_DCERPC_RETURN_READY;

even if it returns failure. In that case, the flag isn't cleared,
since that would be done in rpc_read_request(), which isn't called on
rpc_write_request() failure. So the next RPC to arrive does nothing in
rpc_write_request():

if (pipe->dce->flags & KSMBD_DCERPC_RETURN_READY)
	return KSMBD_RPC_OK;

But the KSMBD_RPC_OK causes rpc_ioctl_request() to assume the results
from the previous failed rpc_write_request() are valid, and it calls
rpc_read_request(). This might cause crashes from use of unexpectedly
NULL or partially initialized pipe->dce->* request data.

I'm submitting this as an issue rather than a patch because I'm not
sure what the flag implies, or how to clean up pipe->dce->* upon
rpc_write_request() failure. Perhaps rpc_ioctl_request() should clear
the RETURN_READY flag on failure, and perhaps rpc_request() should do
the same for RPC_WRITE_METHOD.

Segmentation fault if cifsdpwd.db does not exists.

Getting a segfault and hanging process, if i try to start cifsd, with no database file. This should be allowed if i just want to run via guest.

guest ok = yes
map to guest = Bad User
cifsd -n
[cifsd-worker/13707]: ERROR: Can't open `/etc/cifs/cifsdpwd.db': No such file or directory
[cifsd-worker/13707]: ERROR: Unable to parse user database
[cifsd-worker/13707]: ERROR: Failed to parse configuration files
[cifsd-worker/13707]: ERROR: Child received signal: 11 (Segmentation fault)

move cifsd-team/smbd-tools to cifsd-team/smbd-tools-old and move namjaejeon/smbd-tools to cifsd-team/smbd-tools

First, it is possible to move cifsd-team/smbd-tools to cifsd-team/smbd-tools-archives (or cifsd-team/smbd-tools-old)
and move namjaejeon/smbd-tools to cifsd-team/smbd-tools

Redirections will be here, no lost, you can see for previous links:

There was a change name "cifsd" to "smbd".
The main organization has not changed of name yet.
It is better to do this after the move from personal accounts.

The main project will be not a fork, it will be better ;)

After it, you can move the "cifsd-team/smbd-tools-old" to your github profile or delete ;)

Thanks in advance.

Linked to:

"server signing" parameter?

I try to verify this smb 3.1.1 feature: pre-authentication-integrity

I did disable server signing on the server via:
server signing = disabled

On the Windows 10 client i use LmCompatibiltyLevel=5 and enabled EnableSecuritySignature, RequireSecuritySignature.

yet i can connect to the share via:
net use a: \\router\sharex /user:andy

Get-SmbConnection

ServerName ShareName UserName    Credential Dialect NumOpens
---------- --------- --------    ---------- ------- --------
router     sharex    GAMEPC\andy \andy      3.1.1   1
Get-SmbClientConfiguration

ConnectionCountPerRssNetworkInterface : 4
DirectoryCacheEntriesMax              : 16
DirectoryCacheEntrySizeMax            : 65536
DirectoryCacheLifetime                : 10
DormantFileLimit                      : 1023
EnableBandwidthThrottling             : True
EnableByteRangeLockingOnReadOnlyFiles : True
EnableInsecureGuestLogons             : True
EnableLargeMtu                        : True
EnableLoadBalanceScaleOut             : True
EnableMultiChannel                    : True
EnableSecuritySignature               : True
ExtendedSessionTimeout                : 1000
FileInfoCacheEntriesMax               : 64
FileInfoCacheLifetime                 : 10
FileNotFoundCacheEntriesMax           : 128
FileNotFoundCacheLifetime             : 5
KeepConn                              : 600
MaxCmds                               : 50
MaximumConnectionCountPerServer       : 32
OplocksDisabled                       : False
RequireSecuritySignature              : True
SessionTimeout                        : 60
UseOpportunisticLocking               : True
WindowSizeThreshold                   : 8

My understanding is that this should not be possible in this configuration? Do i miss some option or misunderstand the parameter?

PS: I was trying to test what performance/cpu impact this option has and what defaults to use.

Permission denied with ksmbd-tools 3.5.0-1, but works fine with 3.4.9-1.

Hi,
I have a strange problem happening. Running ksmbd on two Debian Sid Linux systems, both running identical kernels (6.5.10), packages, ksmbd settings, and permission settings on shared dirs. System 1 works fine with ksmbd-tool 3.5.0. I can create/write directories/files no problem. On system 2 I get "permission denied". The only difference between the systems is system 1 has all local storage drives while system 2 (the one giving me "permission denied") has local storage and a usb drive being shared.

Broken system 2 example:

/storage/nvme/ksmbd.share (this is the local storage root/parent ksmbd share)
/storage/nvme/ksmbd.share/dir1 (shared local dir)
/storage/nvme/ksmbd.share/dir2 (shared dir bind mounted from /dev/sdb1 usb drive)

Also, it doesn't matter if the client is Linux or Windows. If I downgrade back to ksmbd-tools 3.4.9-1, then system 2 works fine. I can do a git bisect if necessary..?

[Feature Requests] some interfaces and user related options.

Hi, i would like to see the following or similar parameters to-be implemented.

interfaces
bind interfaces only

This is because openwrt on router/nas devices can have multiple interfaces (lan, wan, bridges...) and usually you only want the fileserver on the lan/bridge.

force group = root
force user = root
inherit owner = windows and unix

I would like a option to specify a owner for new files/folders, independent of the cifs login user. That's so multiple user can be given different access, but all files belong to the same base user.

deadtime

It seems connections are kept open, even after closing from the client side, so having some option to specify the time connections are kept open without any traffic would be nice.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.