Bug 9038 - libsmbclient: SMBC_module_init() does not init global parameters if $HOME is not set
Summary: libsmbclient: SMBC_module_init() does not init global parameters if $HOME is ...
Status: NEW
Alias: None
Product: Samba 3.6
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: 3.6.10
Hardware: All All
: P5 normal
Target Milestone: ---
Assignee: Derrell Lipman
QA Contact: Samba QA Contact
Depends on:
Reported: 2012-07-13 04:19 UTC by SATOH Fumiyasu
Modified: 2012-12-18 05:57 UTC (History)
0 users

See Also:

Proposed patch for Samba 3.6.6 (1.22 KB, patch)
2012-07-13 04:19 UTC, SATOH Fumiyasu
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description SATOH Fumiyasu 2012-07-13 04:19:13 UTC
Created attachment 7700 [details]
Proposed patch for Samba 3.6.6

smbc_free_context(smbcctx) frees the global parameter structure
if there is no other SMBCCTX. But next smbc_new_context()
(SMBC_module_init() called by smbc_new_context()) does not
initialize the new global parameter structure if $HOME
environment variable is not defined. Thus following libsmbclient
APIs call can NOT work correctly.

I've created a test code:


You can see the problem as the below:

  $ wget -q https://gist.github.com/raw/3102379/310928ac6f4538f0debf7321d994c9c6529d5e99/test-libsmbclient-without-HOME-env.c
  $ gcc -lsmbclient test-libsmbclient-without-HOME-env.c
  $ echo $HOME
  $ ./a.out smb://server/share
  Test 1
  Test 2
  Test 3
  Segmentation fault