Bug 5332 - smbc_init_context() returns EINVAL when auth callback is set via smbc_setFunctionAuthDataWithContext()
Summary: smbc_init_context() returns EINVAL when auth callback is set via smbc_setFunc...
Alias: None
Product: Samba 3.2
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: 3.2.0
Hardware: x86 Linux
: P3 major
Target Milestone: ---
Assignee: Derrell Lipman
QA Contact: Samba QA Contact
Depends on:
Reported: 2008-03-17 10:01 UTC by Tomas Bzatek
Modified: 2008-03-17 10:37 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Bzatek 2008-03-17 10:01:37 UTC
1. create new context with smbc_new_context()
2. set auth callback with smbc_setFunctionAuthDataWithContext()
3. call smbc_init_context() on the context
4. NULL is returned and errno is set to EINVAL.

This is due to the following test in libsmb_context.c:

        if (!smbc_getFunctionAuthData(context) ||
            smbc_getDebug(context) < 0 ||
            smbc_getDebug(context) > 100) {
                errno = EINVAL;
                return NULL;

smbc_getFunctionAuthData() always returns NULL when callback with context is set via smbc_setFunctionAuthDataWithContext(). Modifying the test however causes crash in further code - please check as well.
Comment 1 Derrell Lipman 2008-03-17 10:37:43 UTC
Fixed with commit 38eab68dfb2d8abe8ad00f5a86fc54c778d0d303.

Thanks for the report!