mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
Merge branch 'master' of ssh://git.samba.org/data/git/samba into selftest
Conflicts: selftest/selftest.pl
This commit is contained in:
commit
0fd0fc75c4
8
.gitignore
vendored
8
.gitignore
vendored
@ -252,10 +252,10 @@ source4/param/proto.h
|
||||
source4/param/secrets_proto.h
|
||||
source4/param/share_proto.h
|
||||
source4/passdb/proto.h
|
||||
source4/pidl/blib
|
||||
source4/pidl/cover_db
|
||||
source4/pidl/Makefile
|
||||
source4/pidl/pm_to_blib
|
||||
pidl/blib
|
||||
pidl/cover_db
|
||||
pidl/Makefile
|
||||
pidl/pm_to_blib
|
||||
source4/rpc_server/common/proto.h
|
||||
source4/rpc_server/dcerpc_server_proto.h
|
||||
source4/rpc_server/lsa/proto.h
|
||||
|
@ -1,6 +1,7 @@
|
||||
##
|
||||
## Coding conventions in the Samba 3 tree
|
||||
##
|
||||
Coding conventions in the Samba tree
|
||||
------------------------------------
|
||||
|
||||
.. contents::
|
||||
|
||||
===========
|
||||
Quick Start
|
||||
@ -14,15 +15,13 @@ style should never outweigh coding itself and so the the guidelines
|
||||
described here are hopefully easy enough to follow as they are very
|
||||
common and supported by tools and editors.
|
||||
|
||||
The basic style, also mentioned in the SAMBA_4_0/prog_guide.txt is the
|
||||
Linux kernel coding style (See Documentation/CodingStyle in the kernel
|
||||
source tree). The closely matches what most Samba developers use already
|
||||
anyways.
|
||||
The basic style, also mentioned in prog_guide4.txt, is the Linux kernel coding
|
||||
style (See Documentation/CodingStyle in the kernel source tree). This closely
|
||||
matches what most Samba developers use already anyways.
|
||||
|
||||
But to save you the trouble of reading the Linux kernel style guide, here
|
||||
are the highlights.
|
||||
|
||||
|
||||
* Maximum Line Width is 80 Characters
|
||||
The reason is not for people with low-res screens but rather sticking
|
||||
to 80 columns prevents you from easily nesting more than one level of
|
||||
@ -59,14 +58,14 @@ Vi
|
||||
--
|
||||
(Thanks to SATOH Fumiyasu <fumiyas@osstech.jp> for these hints):
|
||||
|
||||
For the basic vi editor including with all variants of *nix, add the
|
||||
For the basic vi editor including with all variants of \*nix, add the
|
||||
following to $HOME/.exrc:
|
||||
|
||||
set tabstop=8
|
||||
set shiftwidth=8
|
||||
|
||||
For Vim, the following settings in $HOME/.vimrc will also deal with
|
||||
displaying trailing whitespace:
|
||||
displaying trailing whitespace::
|
||||
|
||||
if has("syntax") && (&t_Co > 2 || has("gui_running"))
|
||||
syntax on
|
||||
@ -91,7 +90,7 @@ FAQ & Statement Reference
|
||||
Comments
|
||||
--------
|
||||
|
||||
Comments should always use the standard C syntax. I.e. /* ... */. C++
|
||||
Comments should always use the standard C syntax. C++
|
||||
style comments are not currently allowed.
|
||||
|
||||
|
||||
@ -145,7 +144,7 @@ The exception to the ending rule is when the closing brace is followed by
|
||||
another language keyword such as else or the closing while in a do..while
|
||||
loop.
|
||||
|
||||
Good examples:
|
||||
Good examples::
|
||||
|
||||
if (x == 1) {
|
||||
printf("good\n");
|
||||
@ -162,7 +161,7 @@ Good examples:
|
||||
printf("also good\n");
|
||||
} while (1);
|
||||
|
||||
Bad examples:
|
||||
Bad examples::
|
||||
|
||||
while (1)
|
||||
{
|
||||
@ -177,43 +176,43 @@ evil, they can greatly enhance readability and reduce memory leaks when used
|
||||
as the single exit point from a function. But in no Samba world what so ever
|
||||
is a goto outside of a function or block of code a good idea.
|
||||
|
||||
Good Examples:
|
||||
Good Examples::
|
||||
|
||||
int function foo(int y)
|
||||
{
|
||||
int *z = NULL;
|
||||
int ret = 0;
|
||||
int function foo(int y)
|
||||
{
|
||||
int *z = NULL;
|
||||
int ret = 0;
|
||||
|
||||
if ( y < 10 ) {
|
||||
z = malloc(sizeof(int)*y);
|
||||
if (!z) {
|
||||
ret = 1;
|
||||
goto done;
|
||||
if ( y < 10 ) {
|
||||
z = malloc(sizeof(int)*y);
|
||||
if (!z) {
|
||||
ret = 1;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
print("Allocated %d elements.\n", y);
|
||||
|
||||
done:
|
||||
if (z)
|
||||
free(z);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
print("Allocated %d elements.\n", y);
|
||||
|
||||
done:
|
||||
if (z)
|
||||
free(z);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Checking Pointer Values
|
||||
-----------------------
|
||||
|
||||
When invoking functions that return pointer values, either of the following
|
||||
are acceptable. Use you best judgement and choose the more readable option.
|
||||
Remember that many other people will review it.
|
||||
Remember that many other people will review it.::
|
||||
|
||||
if ((x = malloc(sizeof(short)*10)) == NULL ) {
|
||||
fprintf(stderr, "Unable to alloc memory!\n");
|
||||
}
|
||||
|
||||
or
|
||||
or::
|
||||
|
||||
x = malloc(sizeof(short)*10);
|
||||
if (!x) {
|
||||
|
89
docs-xml/manpages-3/idmap_adex.8.xml
Normal file
89
docs-xml/manpages-3/idmap_adex.8.xml
Normal file
@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
|
||||
<refentry id="idmap_adex.8">
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>idmap_adex</refentrytitle>
|
||||
<manvolnum>8</manvolnum>
|
||||
<refmiscinfo class="source">Samba</refmiscinfo>
|
||||
<refmiscinfo class="manual">System Administration tools</refmiscinfo>
|
||||
<refmiscinfo class="version">3.2</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
|
||||
<refnamediv>
|
||||
<refname>idmap_adex</refname>
|
||||
<refpurpose>Samba's idmap_adex Backend for Winbind</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<title>DESCRIPTION</title>
|
||||
<para>
|
||||
The idmap_adex plugin provides a way for Winbind to read
|
||||
id mappings from an AD server that uses RFC2307 schema
|
||||
extensions. This module implements both the idmap and nss_info
|
||||
APIs and supports domain trustes as well as two-way cross
|
||||
forest trusts. It is a read-only plugin requiring that the
|
||||
administrator provide mappings in advance by adding the
|
||||
POSIX attribute information to the users and groups objects
|
||||
in AD. The most common means of doing this is using "Identity
|
||||
Services for Unix" support on Windows 2003 R2 and later.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Note that you must add the uidNumber, gidNumber, and uid
|
||||
attributes to the partial attribute set of the forest global
|
||||
catalog servers. This can be done using the Active Directory Schema
|
||||
Management MMC plugin (schmmgmt.dll).
|
||||
</para>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<title>NSS_INFO</title>
|
||||
<para>
|
||||
The nss_info plugin supports reading the unixHomeDirectory,
|
||||
gidNumber, loginShell, and uidNumber attributes from the user
|
||||
object and the gidNumber attribute from the group object to
|
||||
fill in information required by the libc getpwnam() and
|
||||
getgrnam() family of functions. Group membership is filled in
|
||||
according to the Windows group membership and not the
|
||||
msSFU30PosixMember attribute.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Username aliases are implement by setting the uid attribute
|
||||
on the user object. While group name aliases are implemented
|
||||
by reading the displayname attribute from the group object.
|
||||
</para>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>EXAMPLES</title>
|
||||
<para>
|
||||
The following example shows how to retrieve idmappings and NSS data
|
||||
from our principal and trusted AD domains.
|
||||
</para>
|
||||
|
||||
<programlisting>
|
||||
[global]
|
||||
idmap backend = adex
|
||||
idmap uid = 1000-4000000000
|
||||
idmap gid = 1000-4000000000
|
||||
|
||||
winbind nss info = adex
|
||||
winbind normalize names = yes
|
||||
</programlisting>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>AUTHOR</title>
|
||||
|
||||
<para>
|
||||
The original Samba software and related utilities
|
||||
were created by Andrew Tridgell. Samba is now developed
|
||||
by the Samba Team as an Open Source project similar
|
||||
to the way the Linux kernel is developed.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
76
docs-xml/manpages-3/idmap_hash.8.xml
Normal file
76
docs-xml/manpages-3/idmap_hash.8.xml
Normal file
@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
|
||||
<refentry id="idmap_hash.8">
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>idmap_hash</refentrytitle>
|
||||
<manvolnum>8</manvolnum>
|
||||
<refmiscinfo class="source">Samba</refmiscinfo>
|
||||
<refmiscinfo class="manual">System Administration tools</refmiscinfo>
|
||||
<refmiscinfo class="version">3.2</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
|
||||
<refnamediv>
|
||||
<refname>idmap_hash</refname>
|
||||
<refpurpose>Samba's idmap_hash Backend for Winbind</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<title>DESCRIPTION</title>
|
||||
<para>The idmap_hash plugin implements a hashing algorithm used
|
||||
map SIDs for domain users and groups to a 31-bit uid and gid.
|
||||
This plugin also implements the nss_info API and can be used
|
||||
to support a local name mapping files if enabled via the
|
||||
"winbind normlaize names" and "winbind nss info"
|
||||
parameters in smb.conf.
|
||||
</para>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>IDMAP OPTIONS</title>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>name_map</term>
|
||||
<listitem><para>
|
||||
Specifies the absolute path to the name mapping
|
||||
file used by the nss_info API. Entries in the file
|
||||
are of the form "<replaceable>unix name</replaceable>
|
||||
= <replaceable>qualified domain name</replaceable>"e;.
|
||||
Mapping of both user and group names is supported.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>EXAMPLES</title>
|
||||
<para>The following example utilizes the idmap_hash plugin for
|
||||
the idmap and nss_info information.
|
||||
</para>
|
||||
|
||||
<programlisting>
|
||||
[global]
|
||||
idmap backend = hash
|
||||
idmap uid = 1000-4000000000
|
||||
idmap gid = 1000-4000000000
|
||||
|
||||
winbind nss info = hash
|
||||
winbind normalize names = yes
|
||||
idmap_hash:name_map = /etc/samba/name_map.cfg
|
||||
</programlisting>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>AUTHOR</title>
|
||||
|
||||
<para>
|
||||
The original Samba software and related utilities
|
||||
were created by Andrew Tridgell. Samba is now developed
|
||||
by the Samba Team as an Open Source project similar
|
||||
to the way the Linux kernel is developed.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
@ -134,6 +134,14 @@
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>mkhomedir</term>
|
||||
<listitem><para>
|
||||
Create homedirectory for a user on-the-fly, option is valid in
|
||||
PAM session block.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
|
||||
|
157
docs-xml/manpages-3/vfs_smb_traffic_analyzer.8.xml
Normal file
157
docs-xml/manpages-3/vfs_smb_traffic_analyzer.8.xml
Normal file
@ -0,0 +1,157 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
|
||||
<refentry id="vfs_smb_traffic_analyzer.8">
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>smb_traffic_analyzer</refentrytitle>
|
||||
<manvolnum>8</manvolnum>
|
||||
<refmiscinfo class="source">Samba</refmiscinfo>
|
||||
<refmiscinfo class="manual">System Administration tools</refmiscinfo>
|
||||
<refmiscinfo class="version">3.3</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
|
||||
<refnamediv>
|
||||
<refname>vfs_smb_traffic_analyzer</refname>
|
||||
<refpurpose>log Samba VFS read and write operations through a socket
|
||||
to a helper application</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>vfs objects = smb_traffic_analyzer</command>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>DESCRIPTION</title>
|
||||
|
||||
<para>This VFS module is part of the
|
||||
<citerefentry><refentrytitle>samba</refentrytitle>
|
||||
<manvolnum>7</manvolnum></citerefentry> suite.</para>
|
||||
|
||||
<para>The <command>vfs_smb_traffic_analyzer</command> VFS module logs
|
||||
client write and read operations on a Samba server and sends this data
|
||||
over a socket to a helper program, which feeds a SQL database. More
|
||||
information on the helper programs can be obtained from the
|
||||
homepage of the project at:
|
||||
http://holger123.wordpress.com/smb-traffic-analyzer/
|
||||
</para>
|
||||
<para><command>vfs_smb_traffic_analyzer</command> currently is aware
|
||||
of the following VFS operations:</para>
|
||||
|
||||
<simplelist>
|
||||
<member>write</member>
|
||||
<member>pwrite</member>
|
||||
<member>read</member>
|
||||
<member>pread</member>
|
||||
</simplelist>
|
||||
|
||||
<para><command>vfs_smb_traffic_analyzer</command> sends the following data
|
||||
in a fixed format seperated by a comma through either an internet or a
|
||||
unix domain socket:</para>
|
||||
<programlisting>
|
||||
BYTES|USER|DOMAIN|READ/WRITE|SHARE|FILENAME|TIMESTAMP
|
||||
</programlisting>
|
||||
|
||||
<para>Description of the records:
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><para><command>BYTES</command> - the length in bytes of the VFS operation</para></listitem>
|
||||
<listitem><para><command>USER</command> - the user who initiated the operation</para></listitem>
|
||||
<listitem><para><command>DOMAIN</command> - the domain of the user</para></listitem>
|
||||
<listitem><para><command>READ/WRITE</command> - either "W" for a write operation or "R" for read</para></listitem>
|
||||
<listitem><para><command>SHARE</command> - the name of the share on which the VFS operation occured</para></listitem>
|
||||
<listitem><para><command>FILENAME</command> - the name of the file that was used by the VFS operation</para></listitem>
|
||||
<listitem><para><command>TIMESTAMP</command> - a timestamp, formatted as "yyyy-mm-dd hh-mm-ss.ms" indicating when the VFS operation occured</para></listitem>
|
||||
</itemizedlist>
|
||||
|
||||
</para>
|
||||
|
||||
<para>This module is stackable.</para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
|
||||
<refsect1>
|
||||
<title>OPTIONS</title>
|
||||
|
||||
<variablelist>
|
||||
|
||||
<varlistentry>
|
||||
<term>smb_traffic_analyzer:mode = STRING</term>
|
||||
<listitem>
|
||||
<para>If STRING matches to "unix_domain_socket", the module will
|
||||
use a unix domain socket located at /var/tmp/stadsocket, if
|
||||
STRING contains an different string or is not defined, the module will
|
||||
use an internet domain socket for data transfer.</para>
|
||||
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry>
|
||||
<term>smb_traffic_analyzer:host = STRING</term>
|
||||
<listitem>
|
||||
<para>The module will send the data to the system named with
|
||||
the hostname STRING.</para>
|
||||
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>smb_traffic_analyzer:port = STRING</term>
|
||||
<listitem>
|
||||
<para>The module will send the data using the TCP port given
|
||||
in STRING
|
||||
</para>
|
||||
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>EXAMPLES</title>
|
||||
|
||||
<para>The module running on share "example_share", using a unix domain socket</para>
|
||||
<programlisting>
|
||||
<smbconfsection name="[example_share]"/>
|
||||
<smbconfoption name="path">/data/example</smbconfoption>
|
||||
<smbconfoption name="vfs objects">smb_traffic_analyzer</smbconfoption>
|
||||
<smbconfoption name="smb_traffic_analyzer:mode">unix_domain_socket</smbconfoption>
|
||||
</programlisting>
|
||||
|
||||
<para>The module running on share "example_share", using an internet domain socket,
|
||||
connecting to host "examplehost" on port 3491.</para>
|
||||
<programlisting>
|
||||
<smbconfsection name="[example_share]"/>
|
||||
<smbconfoption name="path">/data/example</smbconfoption>
|
||||
<smbconfoption name="vfs objects">smb_traffic_analyzer</smbconfoption>
|
||||
<smbconfoption name="smb_traffic_analyzer:host">examplehost</smbconfoption>
|
||||
<smbconfoption name="smb_traffic_analyzer:port">3490</smbconfoption>
|
||||
</programlisting>
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>VERSION</title>
|
||||
<para>This man page is correct for version 3.3 of the Samba suite.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>AUTHOR</title>
|
||||
|
||||
<para>The original Samba software and related utilities
|
||||
were created by Andrew Tridgell. Samba is now developed
|
||||
by the Samba Team as an Open Source project similar
|
||||
to the way the Linux kernel is developed.</para>
|
||||
|
||||
<para>The original version of the VFS module and the
|
||||
helper tools were created by Holger Hetterich.</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
20
docs-xml/smbdotconf/printing/cupsconnectiontimeout.xml
Normal file
20
docs-xml/smbdotconf/printing/cupsconnectiontimeout.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<samba:parameter name="cups connection timeout"
|
||||
context="G"
|
||||
type="integer"
|
||||
print="1"
|
||||
xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
|
||||
<description>
|
||||
<para>
|
||||
This parameter is only applicable if <smbconfoption name="printing"/> is set to <constant>cups</constant>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If set, this option specifies the number of seconds that smbd will wait
|
||||
whilst trying to contact to the CUPS server. The connection will fail
|
||||
if it takes longer than this number of seconds.
|
||||
</para>
|
||||
</description>
|
||||
|
||||
<value type="default">30</value>
|
||||
<value type="example">60</value>
|
||||
</samba:parameter>
|
@ -5,14 +5,25 @@
|
||||
xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
|
||||
<description>
|
||||
<para>This parameter controls whether winbindd will replace
|
||||
whitespace in user and group names with an underscore (_) character.
|
||||
For example, whether the name "Space Kadet" should be
|
||||
replaced with the string "space_kadet".
|
||||
Frequently Unix shell scripts will have difficulty with usernames
|
||||
contains whitespace due to the default field separator in the shell.
|
||||
Do not enable this option if the underscore character is used in
|
||||
account names within your domain
|
||||
</para>
|
||||
whitespace in user and group names with an underscore (_) character.
|
||||
For example, whether the name "Space Kadet" should be
|
||||
replaced with the string "space_kadet".
|
||||
Frequently Unix shell scripts will have difficulty with usernames
|
||||
contains whitespace due to the default field separator in the shell.
|
||||
If your domain possesses names containing the underscore character,
|
||||
this option may cause problems unless the name aliasing feature
|
||||
is supported by your nss_info plugin.
|
||||
</para>
|
||||
|
||||
<para>This feature also enables the name aliasing API which can
|
||||
be used to make domain user and group names to a non-qlaified
|
||||
version. Please refer to the manpage for the configured
|
||||
idmap and nss_info plugin for the specifics on how to configure
|
||||
name aliasing for a specific configuration. Name aliasing takes
|
||||
precendence (and is mutually exclusive) over the whitespace
|
||||
replacement mechanism discussed previsouly.
|
||||
</para>
|
||||
|
||||
</description>
|
||||
|
||||
<value type="default">no</value>
|
||||
|
@ -315,7 +315,7 @@ static size_t skel_get_nt_acl(vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
|
||||
uint32 security_info_sent, SEC_DESC *psd)
|
||||
uint32 security_info_sent, const SEC_DESC *psd)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return NT_STATUS_NOT_IMPLEMENTED;
|
||||
|
@ -302,7 +302,7 @@ static NTSTATUS skel_get_nt_acl(vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
|
||||
uint32 security_info_sent, SEC_DESC *psd)
|
||||
uint32 security_info_sent, const SEC_DESC *psd)
|
||||
{
|
||||
return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
|
||||
}
|
||||
|
@ -33,3 +33,6 @@
|
||||
|
||||
# omit pam conversations
|
||||
;silent = no
|
||||
|
||||
# create homedirectory on the fly
|
||||
;mkhomedir = no
|
||||
|
@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include "lib/crypto/crypto.h"
|
||||
#include "../lib/crypto/arcfour.h"
|
||||
|
||||
/* initialise the arcfour sbox with key */
|
||||
_PUBLIC_ void arcfour_init(struct arcfour_state *state, const DATA_BLOB *key)
|
15
lib/crypto/arcfour.h
Normal file
15
lib/crypto/arcfour.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef ARCFOUR_HEADER_H
|
||||
#define ARCFOUR_HEADER_H
|
||||
|
||||
struct arcfour_state {
|
||||
uint8_t sbox[256];
|
||||
uint8_t index_i;
|
||||
uint8_t index_j;
|
||||
};
|
||||
|
||||
void arcfour_init(struct arcfour_state *state, const DATA_BLOB *key);
|
||||
void arcfour_crypt_sbox(struct arcfour_state *state, uint8_t *data, int len);
|
||||
void arcfour_crypt_blob(uint8_t *data, int len, const DATA_BLOB *key);
|
||||
void arcfour_crypt(uint8_t *data, const uint8_t keystr[16], int len);
|
||||
|
||||
#endif /* ARCFOUR_HEADER_H */
|
@ -1,9 +1,7 @@
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
Manually parsed structures found in the DRS protocol
|
||||
|
||||
Copyright (C) Andrew Bartlett <abartlet@samba.org> 2008
|
||||
Copyright (C) Andrew Tridgell 2004
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -19,10 +17,12 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __LIBCLI_DRSBLOBS_H__
|
||||
#define __LIBCLI_DRSBLOBS_H__
|
||||
#include "../lib/crypto/crc32.h"
|
||||
#include "../lib/crypto/md4.h"
|
||||
#include "../lib/crypto/md5.h"
|
||||
#include "../lib/crypto/hmacmd5.h"
|
||||
#include "../lib/crypto/sha256.h"
|
||||
#include "../lib/crypto/hmacsha256.h"
|
||||
#include "../lib/crypto/arcfour.h"
|
||||
|
||||
#include "librpc/gen_ndr/ndr_drsblobs.h"
|
||||
|
||||
#include "libcli/drsblobs_proto.h"
|
||||
#endif /* __CLDAP_SERVER_PROTO_H__ */
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include "lib/crypto/crypto.h"
|
||||
#include "../lib/crypto/hmacmd5.h"
|
||||
|
||||
/***********************************************************************
|
||||
the rfc 2104 version of hmac_md5 initialisation.
|
@ -19,6 +19,9 @@
|
||||
*/
|
||||
|
||||
#ifndef _HMAC_MD5_H
|
||||
#define _HMAC_MD5_H
|
||||
|
||||
#include "../lib/crypto/md5.h"
|
||||
|
||||
typedef struct
|
||||
{
|
@ -17,7 +17,7 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "includes.h"
|
||||
#include "lib/crypto/crypto.h"
|
||||
#include "../lib/crypto/crypto.h"
|
||||
|
||||
struct torture_context;
|
||||
|
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include "lib/crypto/crypto.h"
|
||||
#include "../lib/crypto/crypto.h"
|
||||
|
||||
/***********************************************************************
|
||||
the rfc 2104/2202 version of hmac_sha256 initialisation.
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include "lib/crypto/crypto.h"
|
||||
#include "../lib/crypto/crypto.h"
|
||||
|
||||
struct torture_context;
|
||||
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include "lib/crypto/crypto.h"
|
||||
#include "../lib/crypto/crypto.h"
|
||||
|
||||
struct torture_context;
|
||||
|
@ -9,7 +9,8 @@ libdir = @libdir@
|
||||
VPATH = @libreplacedir@
|
||||
srcdir = @srcdir@
|
||||
builddir = @builddir@
|
||||
INSTALL = @INSTALL@
|
||||
sharedbuilddir = @sharedbuilddir@
|
||||
INSTALLCMD = @INSTALL@
|
||||
LIBS = @LIBS@
|
||||
|
||||
.PHONY: test all showflags install installcheck clean distclean realdistclean
|
||||
@ -29,8 +30,14 @@ showflags:
|
||||
@echo ' LIBS = $(LIBS)'
|
||||
|
||||
install: all
|
||||
mkdir -p $(libdir)
|
||||
$(INSTALL) libreplace.a $(libdir)
|
||||
${INSTALLCMD} -d $(libdir)
|
||||
${INSTALLCMD} -m 644 libreplace.a $(libdir)
|
||||
|
||||
shared-build: all
|
||||
${INSTALLCMD} -d $(sharedbuilddir)/include
|
||||
${INSTALLCMD} -m 644 replace.h $(sharedbuilddir)/include
|
||||
${INSTALLCMD} -d $(sharedbuilddir)/lib
|
||||
${INSTALLCMD} -m 644 libreplace.a $(sharedbuilddir)/lib
|
||||
|
||||
libreplace.a: $(OBJS)
|
||||
ar -rcsv $@ $(OBJS)
|
||||
@ -40,7 +47,7 @@ test: all
|
||||
|
||||
installcheck: install test
|
||||
|
||||
TEST_OBJS = test/testsuite.o test/os2_delete.o test/strptime.o test/getifaddrs.o
|
||||
TEST_OBJS = test/main.o test/testsuite.o test/os2_delete.o test/strptime.o test/getifaddrs.o
|
||||
|
||||
testsuite: libreplace.a $(TEST_OBJS)
|
||||
$(CC) -o testsuite $(TEST_OBJS) -L. -lreplace $(LDFLAGS) $(LIBS)
|
||||
|
14
lib/replace/build_macros.m4
Normal file
14
lib/replace/build_macros.m4
Normal file
@ -0,0 +1,14 @@
|
||||
AC_DEFUN(BUILD_WITH_SHARED_BUILD_DIR,
|
||||
[ AC_ARG_WITH([shared-build-dir],
|
||||
[AC_HELP_STRING([--with-shared-build-dir=DIR],
|
||||
[temporary build directory where libraries are installed [$srcdir/sharedbuild]])])
|
||||
|
||||
sharedbuilddir="$srcdir/sharedbuild"
|
||||
if test x"$with_shared_build_dir" != x; then
|
||||
sharedbuilddir=$with_shared_build_dir
|
||||
CFLAGS="$CFLAGS -I$with_shared_build_dir/include"
|
||||
LDFLAGS="$LDFLAGS -L$with_shared_build_dir/lib"
|
||||
fi
|
||||
AC_SUBST(sharedbuilddir)
|
||||
])
|
||||
|
@ -22,6 +22,9 @@ if test "$ac_cv_prog_gcc" = yes; then
|
||||
CFLAGS="$CFLAGS -Wno-format-y2k"
|
||||
fi
|
||||
|
||||
m4_include(build_macros.m4)
|
||||
BUILD_WITH_SHARED_BUILD_DIR
|
||||
|
||||
LIBS="${LIBREPLACE_NETWORK_LIBS}"
|
||||
AC_SUBST(LIBS)
|
||||
|
||||
|
@ -5,7 +5,7 @@ echo "LIBREPLACE_LOCATION_CHECKS: START"
|
||||
dnl find the libreplace sources. This is meant to work both for
|
||||
dnl libreplace standalone builds, and builds of packages using libreplace
|
||||
libreplacedir=""
|
||||
libreplacepaths="$srcdir $srcdir/lib/replace $srcdir/libreplace $srcdir/../libreplace $srcdir/../replace $srcdir/../lib/replace"
|
||||
libreplacepaths="$srcdir $srcdir/lib/replace $srcdir/libreplace $srcdir/../libreplace $srcdir/../replace $srcdir/../lib/replace $srcdir/../../../lib/replace"
|
||||
for d in $libreplacepaths; do
|
||||
if test -f "$d/replace.c"; then
|
||||
libreplacedir="$d"
|
||||
@ -34,7 +34,7 @@ echo "LIBREPLACE_BROKEN_CHECKS: START"
|
||||
dnl find the libreplace sources. This is meant to work both for
|
||||
dnl libreplace standalone builds, and builds of packages using libreplace
|
||||
libreplacedir=""
|
||||
libreplacepaths="$srcdir $srcdir/lib/replace $srcdir/libreplace $srcdir/../libreplace $srcdir/../replace $srcdir/../lib/replace"
|
||||
libreplacepaths="$srcdir $srcdir/lib/replace $srcdir/libreplace $srcdir/../libreplace $srcdir/../replace $srcdir/../lib/replace $srcdir/../../../lib/replace"
|
||||
for d in $libreplacepaths; do
|
||||
if test -f "$d/replace.c"; then
|
||||
libreplacedir="$d"
|
||||
|
37
lib/replace/test/main.c
Normal file
37
lib/replace/test/main.c
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
libreplace tests
|
||||
|
||||
Copyright (C) Jelmer Vernooij 2006
|
||||
|
||||
** NOTE! The following LGPL license applies to the talloc
|
||||
** library. This does NOT imply that all of Samba is released
|
||||
** under the LGPL
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "replace.h"
|
||||
|
||||
struct torture_context;
|
||||
bool torture_local_replace(struct torture_context *ctx);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
bool ret = torture_local_replace(NULL);
|
||||
if (ret)
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
@ -1068,13 +1068,3 @@ bool torture_local_replace(struct torture_context *ctx)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if _SAMBA_BUILD_<4
|
||||
int main(void)
|
||||
{
|
||||
bool ret = torture_local_replace(NULL);
|
||||
if (ret)
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
@ -750,7 +750,7 @@ static struct swrap_packet *swrap_packet_init(struct timeval *tval,
|
||||
int socket_type,
|
||||
const unsigned char *payload,
|
||||
size_t payload_len,
|
||||
unsigned long tcp_seq,
|
||||
unsigned long tcp_seqno,
|
||||
unsigned long tcp_ack,
|
||||
unsigned char tcp_ctl,
|
||||
int unreachable,
|
||||
@ -852,7 +852,7 @@ static struct swrap_packet *swrap_packet_init(struct timeval *tval,
|
||||
case SOCK_STREAM:
|
||||
packet->ip.p.tcp.source_port = src_port;
|
||||
packet->ip.p.tcp.dest_port = dest_port;
|
||||
packet->ip.p.tcp.seq_num = htonl(tcp_seq);
|
||||
packet->ip.p.tcp.seq_num = htonl(tcp_seqno);
|
||||
packet->ip.p.tcp.ack_num = htonl(tcp_ack);
|
||||
packet->ip.p.tcp.hdr_length = 0x50; /* 5 * 32 bit words */
|
||||
packet->ip.p.tcp.control = tcp_ctl;
|
||||
@ -916,7 +916,7 @@ static struct swrap_packet *swrap_marshall_packet(struct socket_info *si,
|
||||
{
|
||||
const struct sockaddr_in *src_addr;
|
||||
const struct sockaddr_in *dest_addr;
|
||||
unsigned long tcp_seq = 0;
|
||||
unsigned long tcp_seqno = 0;
|
||||
unsigned long tcp_ack = 0;
|
||||
unsigned char tcp_ctl = 0;
|
||||
int unreachable = 0;
|
||||
@ -937,7 +937,7 @@ static struct swrap_packet *swrap_marshall_packet(struct socket_info *si,
|
||||
src_addr = (const struct sockaddr_in *)si->myname;
|
||||
dest_addr = (const struct sockaddr_in *)addr;
|
||||
|
||||
tcp_seq = si->io.pck_snd;
|
||||
tcp_seqno = si->io.pck_snd;
|
||||
tcp_ack = si->io.pck_rcv;
|
||||
tcp_ctl = 0x02; /* SYN */
|
||||
|
||||
@ -951,7 +951,7 @@ static struct swrap_packet *swrap_marshall_packet(struct socket_info *si,
|
||||
dest_addr = (const struct sockaddr_in *)si->myname;
|
||||
src_addr = (const struct sockaddr_in *)addr;
|
||||
|
||||
tcp_seq = si->io.pck_rcv;
|
||||
tcp_seqno = si->io.pck_rcv;
|
||||
tcp_ack = si->io.pck_snd;
|
||||
tcp_ctl = 0x12; /** SYN,ACK */
|
||||
|
||||
@ -966,7 +966,7 @@ static struct swrap_packet *swrap_marshall_packet(struct socket_info *si,
|
||||
src_addr = (const struct sockaddr_in *)addr;
|
||||
|
||||
/* Unreachable: resend the data of SWRAP_CONNECT_SEND */
|
||||
tcp_seq = si->io.pck_snd - 1;
|
||||
tcp_seqno = si->io.pck_snd - 1;
|
||||
tcp_ack = si->io.pck_rcv;
|
||||
tcp_ctl = 0x02; /* SYN */
|
||||
unreachable = 1;
|
||||
@ -979,7 +979,7 @@ static struct swrap_packet *swrap_marshall_packet(struct socket_info *si,
|
||||
src_addr = (const struct sockaddr_in *)si->myname;
|
||||
dest_addr = (const struct sockaddr_in *)addr;
|
||||
|
||||
tcp_seq = si->io.pck_snd;
|
||||
tcp_seqno = si->io.pck_snd;
|
||||
tcp_ack = si->io.pck_rcv;
|
||||
tcp_ctl = 0x10; /* ACK */
|
||||
|
||||
@ -991,7 +991,7 @@ static struct swrap_packet *swrap_marshall_packet(struct socket_info *si,
|
||||
dest_addr = (const struct sockaddr_in *)si->myname;
|
||||
src_addr = (const struct sockaddr_in *)addr;
|
||||
|
||||
tcp_seq = si->io.pck_rcv;
|
||||
tcp_seqno = si->io.pck_rcv;
|
||||
tcp_ack = si->io.pck_snd;
|
||||
tcp_ctl = 0x02; /* SYN */
|
||||
|
||||
@ -1005,7 +1005,7 @@ static struct swrap_packet *swrap_marshall_packet(struct socket_info *si,
|
||||
src_addr = (const struct sockaddr_in *)si->myname;
|
||||
dest_addr = (const struct sockaddr_in *)addr;
|
||||
|
||||
tcp_seq = si->io.pck_snd;
|
||||
tcp_seqno = si->io.pck_snd;
|
||||
tcp_ack = si->io.pck_rcv;
|
||||
tcp_ctl = 0x12; /* SYN,ACK */
|
||||
|
||||
@ -1019,7 +1019,7 @@ static struct swrap_packet *swrap_marshall_packet(struct socket_info *si,
|
||||
dest_addr = (const struct sockaddr_in *)si->myname;
|
||||
src_addr = (const struct sockaddr_in *)addr;
|
||||
|
||||
tcp_seq = si->io.pck_rcv;
|
||||
tcp_seqno = si->io.pck_rcv;
|
||||
tcp_ack = si->io.pck_snd;
|
||||
tcp_ctl = 0x10; /* ACK */
|
||||
|
||||
@ -1029,7 +1029,7 @@ static struct swrap_packet *swrap_marshall_packet(struct socket_info *si,
|
||||
src_addr = (const struct sockaddr_in *)si->myname;
|
||||
dest_addr = (const struct sockaddr_in *)si->peername;
|
||||
|
||||
tcp_seq = si->io.pck_snd;
|
||||
tcp_seqno = si->io.pck_snd;
|
||||
tcp_ack = si->io.pck_rcv;
|
||||
tcp_ctl = 0x18; /* PSH,ACK */
|
||||
|
||||
@ -1047,7 +1047,7 @@ static struct swrap_packet *swrap_marshall_packet(struct socket_info *si,
|
||||
buf, len, packet_len);
|
||||
}
|
||||
|
||||
tcp_seq = si->io.pck_rcv;
|
||||
tcp_seqno = si->io.pck_rcv;
|
||||
tcp_ack = si->io.pck_snd;
|
||||
tcp_ctl = 0x14; /** RST,ACK */
|
||||
|
||||
@ -1061,7 +1061,7 @@ static struct swrap_packet *swrap_marshall_packet(struct socket_info *si,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tcp_seq = si->io.pck_rcv;
|
||||
tcp_seqno = si->io.pck_rcv;
|
||||
tcp_ack = si->io.pck_snd;
|
||||
tcp_ctl = 0x14; /* RST,ACK */
|
||||
|
||||
@ -1071,7 +1071,7 @@ static struct swrap_packet *swrap_marshall_packet(struct socket_info *si,
|
||||
dest_addr = (const struct sockaddr_in *)si->myname;
|
||||
src_addr = (const struct sockaddr_in *)si->peername;
|
||||
|
||||
tcp_seq = si->io.pck_rcv;
|
||||
tcp_seqno = si->io.pck_rcv;
|
||||
tcp_ack = si->io.pck_snd;
|
||||
tcp_ctl = 0x18; /* PSH,ACK */
|
||||
|
||||
@ -1087,7 +1087,7 @@ static struct swrap_packet *swrap_marshall_packet(struct socket_info *si,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tcp_seq = si->io.pck_rcv;
|
||||
tcp_seqno = si->io.pck_rcv;
|
||||
tcp_ack = si->io.pck_snd;
|
||||
tcp_ctl = 0x14; /* RST,ACK */
|
||||
|
||||
@ -1123,7 +1123,7 @@ static struct swrap_packet *swrap_marshall_packet(struct socket_info *si,
|
||||
src_addr = (const struct sockaddr_in *)si->myname;
|
||||
dest_addr = (const struct sockaddr_in *)si->peername;
|
||||
|
||||
tcp_seq = si->io.pck_snd;
|
||||
tcp_seqno = si->io.pck_snd;
|
||||
tcp_ack = si->io.pck_rcv;
|
||||
tcp_ctl = 0x11; /* FIN, ACK */
|
||||
|
||||
@ -1137,7 +1137,7 @@ static struct swrap_packet *swrap_marshall_packet(struct socket_info *si,
|
||||
dest_addr = (const struct sockaddr_in *)si->myname;
|
||||
src_addr = (const struct sockaddr_in *)si->peername;
|
||||
|
||||
tcp_seq = si->io.pck_rcv;
|
||||
tcp_seqno = si->io.pck_rcv;
|
||||
tcp_ack = si->io.pck_snd;
|
||||
tcp_ctl = 0x11; /* FIN,ACK */
|
||||
|
||||
@ -1151,7 +1151,7 @@ static struct swrap_packet *swrap_marshall_packet(struct socket_info *si,
|
||||
src_addr = (const struct sockaddr_in *)si->myname;
|
||||
dest_addr = (const struct sockaddr_in *)si->peername;
|
||||
|
||||
tcp_seq = si->io.pck_snd;
|
||||
tcp_seqno = si->io.pck_snd;
|
||||
tcp_ack = si->io.pck_rcv;
|
||||
tcp_ctl = 0x10; /* ACK */
|
||||
|
||||
@ -1164,7 +1164,7 @@ static struct swrap_packet *swrap_marshall_packet(struct socket_info *si,
|
||||
|
||||
return swrap_packet_init(&tv, src_addr, dest_addr, si->type,
|
||||
(const unsigned char *)buf, len,
|
||||
tcp_seq, tcp_ack, tcp_ctl, unreachable,
|
||||
tcp_seqno, tcp_ack, tcp_ctl, unreachable,
|
||||
packet_len);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,8 @@
|
||||
#!/usr/bin/perl
|
||||
# Simple script that converts Perl test harness output to
|
||||
# Subunit
|
||||
# Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
|
||||
# Published under the GNU GPL, v3 or later
|
||||
|
||||
my $firstline = 1;
|
||||
my $error = 0;
|
80
lib/subunit/python/subunit/tests/TestUtil.py
Normal file
80
lib/subunit/python/subunit/tests/TestUtil.py
Normal file
@ -0,0 +1,80 @@
|
||||
# Copyright (c) 2004 Canonical Limited
|
||||
# Author: Robert Collins <robert.collins@canonical.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
import sys
|
||||
import logging
|
||||
import unittest
|
||||
|
||||
|
||||
class LogCollector(logging.Handler):
|
||||
def __init__(self):
|
||||
logging.Handler.__init__(self)
|
||||
self.records=[]
|
||||
def emit(self, record):
|
||||
self.records.append(record.getMessage())
|
||||
|
||||
|
||||
def makeCollectingLogger():
|
||||
"""I make a logger instance that collects its logs for programmatic analysis
|
||||
-> (logger, collector)"""
|
||||
logger=logging.Logger("collector")
|
||||
handler=LogCollector()
|
||||
handler.setFormatter(logging.Formatter("%(levelname)s: %(message)s"))
|
||||
logger.addHandler(handler)
|
||||
return logger, handler
|
||||
|
||||
|
||||
def visitTests(suite, visitor):
|
||||
"""A foreign method for visiting the tests in a test suite."""
|
||||
for test in suite._tests:
|
||||
#Abusing types to avoid monkey patching unittest.TestCase.
|
||||
# Maybe that would be better?
|
||||
try:
|
||||
test.visit(visitor)
|
||||
except AttributeError:
|
||||
if isinstance(test, unittest.TestCase):
|
||||
visitor.visitCase(test)
|
||||
elif isinstance(test, unittest.TestSuite):
|
||||
visitor.visitSuite(test)
|
||||
visitTests(test, visitor)
|
||||
else:
|
||||
print "unvisitable non-unittest.TestCase element %r (%r)" % (test, test.__class__)
|
||||
|
||||
|
||||
class TestSuite(unittest.TestSuite):
|
||||
"""I am an extended TestSuite with a visitor interface.
|
||||
This is primarily to allow filtering of tests - and suites or
|
||||
more in the future. An iterator of just tests wouldn't scale..."""
|
||||
|
||||
def visit(self, visitor):
|
||||
"""visit the composite. Visiting is depth-first.
|
||||
current callbacks are visitSuite and visitCase."""
|
||||
visitor.visitSuite(self)
|
||||
visitTests(self, visitor)
|
||||
|
||||
|
||||
class TestLoader(unittest.TestLoader):
|
||||
"""Custome TestLoader to set the right TestSuite class."""
|
||||
suiteClass = TestSuite
|
||||
|
||||
class TestVisitor(object):
|
||||
"""A visitor for Tests"""
|
||||
def visitSuite(self, aTestSuite):
|
||||
pass
|
||||
def visitCase(self, aTestCase):
|
||||
pass
|
25
lib/subunit/python/subunit/tests/__init__.py
Normal file
25
lib/subunit/python/subunit/tests/__init__.py
Normal file
@ -0,0 +1,25 @@
|
||||
#
|
||||
# subunit: extensions to python unittest to get test results from subprocesses.
|
||||
# Copyright (C) 2005 Robert Collins <robertc@robertcollins.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
from subunit.tests import TestUtil, test_test_protocol
|
||||
|
||||
def test_suite():
|
||||
result = TestUtil.TestSuite()
|
||||
result.addTest(test_test_protocol.test_suite())
|
||||
return result
|
11
lib/subunit/python/subunit/tests/sample-script.py
Executable file
11
lib/subunit/python/subunit/tests/sample-script.py
Executable file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env python
|
||||
import sys
|
||||
print "test old mcdonald"
|
||||
print "success old mcdonald"
|
||||
print "test bing crosby"
|
||||
print "failure bing crosby ["
|
||||
print "foo.c:53:ERROR invalid state"
|
||||
print "]"
|
||||
print "test an error"
|
||||
print "error an error"
|
||||
sys.exit(0)
|
7
lib/subunit/python/subunit/tests/sample-two-script.py
Executable file
7
lib/subunit/python/subunit/tests/sample-two-script.py
Executable file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
import sys
|
||||
print "test old mcdonald"
|
||||
print "success old mcdonald"
|
||||
print "test bing crosby"
|
||||
print "success bing crosby"
|
||||
sys.exit(0)
|
730
lib/subunit/python/subunit/tests/test_test_protocol.py
Normal file
730
lib/subunit/python/subunit/tests/test_test_protocol.py
Normal file
@ -0,0 +1,730 @@
|
||||
#
|
||||
# subunit: extensions to python unittest to get test results from subprocesses.
|
||||
# Copyright (C) 2005 Robert Collins <robertc@robertcollins.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
import unittest
|
||||
from StringIO import StringIO
|
||||
import os
|
||||
import subunit
|
||||
import sys
|
||||
|
||||
try:
|
||||
class MockTestProtocolServerClient(object):
|
||||
"""A mock protocol server client to test callbacks."""
|
||||
|
||||
def __init__(self):
|
||||
self.end_calls = []
|
||||
self.error_calls = []
|
||||
self.failure_calls = []
|
||||
self.start_calls = []
|
||||
self.success_calls = []
|
||||
super(MockTestProtocolServerClient, self).__init__()
|
||||
|
||||
def addError(self, test, error):
|
||||
self.error_calls.append((test, error))
|
||||
|
||||
def addFailure(self, test, error):
|
||||
self.failure_calls.append((test, error))
|
||||
|
||||
def addSuccess(self, test):
|
||||
self.success_calls.append(test)
|
||||
|
||||
def stopTest(self, test):
|
||||
self.end_calls.append(test)
|
||||
|
||||
def startTest(self, test):
|
||||
self.start_calls.append(test)
|
||||
|
||||
except AttributeError:
|
||||
MockTestProtocolServer = None
|
||||
|
||||
|
||||
class TestMockTestProtocolServer(unittest.TestCase):
|
||||
|
||||
def test_start_test(self):
|
||||
protocol = MockTestProtocolServerClient()
|
||||
protocol.startTest(subunit.RemotedTestCase("test old mcdonald"))
|
||||
self.assertEqual(protocol.start_calls,
|
||||
[subunit.RemotedTestCase("test old mcdonald")])
|
||||
self.assertEqual(protocol.end_calls, [])
|
||||
self.assertEqual(protocol.error_calls, [])
|
||||
self.assertEqual(protocol.failure_calls, [])
|
||||
self.assertEqual(protocol.success_calls, [])
|
||||
|
||||
def test_add_error(self):
|
||||
protocol = MockTestProtocolServerClient()
|
||||
protocol.addError(subunit.RemotedTestCase("old mcdonald"),
|
||||
subunit.RemoteError("omg it works"))
|
||||
self.assertEqual(protocol.start_calls, [])
|
||||
self.assertEqual(protocol.end_calls, [])
|
||||
self.assertEqual(protocol.error_calls, [(
|
||||
subunit.RemotedTestCase("old mcdonald"),
|
||||
subunit.RemoteError("omg it works"))])
|
||||
self.assertEqual(protocol.failure_calls, [])
|
||||
self.assertEqual(protocol.success_calls, [])
|
||||
|
||||
def test_add_failure(self):
|
||||
protocol = MockTestProtocolServerClient()
|
||||
protocol.addFailure(subunit.RemotedTestCase("old mcdonald"),
|
||||
subunit.RemoteError("omg it works"))
|
||||
self.assertEqual(protocol.start_calls, [])
|
||||
self.assertEqual(protocol.end_calls, [])
|
||||
self.assertEqual(protocol.error_calls, [])
|
||||
self.assertEqual(protocol.failure_calls, [
|
||||
(subunit.RemotedTestCase("old mcdonald"),
|
||||
subunit.RemoteError("omg it works"))])
|
||||
self.assertEqual(protocol.success_calls, [])
|
||||
|
||||
def test_add_success(self):
|
||||
protocol = MockTestProtocolServerClient()
|
||||
protocol.addSuccess(subunit.RemotedTestCase("test old mcdonald"))
|
||||
self.assertEqual(protocol.start_calls, [])
|
||||
self.assertEqual(protocol.end_calls, [])
|
||||
self.assertEqual(protocol.error_calls, [])
|
||||
self.assertEqual(protocol.failure_calls, [])
|
||||
self.assertEqual(protocol.success_calls,
|
||||
[subunit.RemotedTestCase("test old mcdonald")])
|
||||
|
||||
def test_end_test(self):
|
||||
protocol = MockTestProtocolServerClient()
|
||||
protocol.stopTest(subunit.RemotedTestCase("test old mcdonald"))
|
||||
self.assertEqual(protocol.end_calls,
|
||||
[subunit.RemotedTestCase("test old mcdonald")])
|
||||
self.assertEqual(protocol.error_calls, [])
|
||||
self.assertEqual(protocol.failure_calls, [])
|
||||
self.assertEqual(protocol.success_calls, [])
|
||||
self.assertEqual(protocol.start_calls, [])
|
||||
|
||||
|
||||
class TestTestImports(unittest.TestCase):
|
||||
|
||||
def test_imports(self):
|
||||
from subunit import TestProtocolServer
|
||||
from subunit import RemotedTestCase
|
||||
from subunit import RemoteError
|
||||
from subunit import ExecTestCase
|
||||
from subunit import IsolatedTestCase
|
||||
from subunit import TestProtocolClient
|
||||
|
||||
|
||||
class TestTestProtocolServerPipe(unittest.TestCase):
|
||||
|
||||
def test_story(self):
|
||||
client = unittest.TestResult()
|
||||
protocol = subunit.TestProtocolServer(client)
|
||||
pipe = StringIO("test old mcdonald\n"
|
||||
"success old mcdonald\n"
|
||||
"test bing crosby\n"
|
||||
"failure bing crosby [\n"
|
||||
"foo.c:53:ERROR invalid state\n"
|
||||
"]\n"
|
||||
"test an error\n"
|
||||
"error an error\n")
|
||||
protocol.readFrom(pipe)
|
||||
mcdonald = subunit.RemotedTestCase("old mcdonald")
|
||||
bing = subunit.RemotedTestCase("bing crosby")
|
||||
an_error = subunit.RemotedTestCase("an error")
|
||||
self.assertEqual(client.errors,
|
||||
[(an_error, 'RemoteException: \n\n')])
|
||||
self.assertEqual(
|
||||
client.failures,
|
||||
[(bing, "RemoteException: foo.c:53:ERROR invalid state\n\n")])
|
||||
self.assertEqual(client.testsRun, 3)
|
||||
|
||||
|
||||
class TestTestProtocolServerStartTest(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.client = MockTestProtocolServerClient()
|
||||
self.protocol = subunit.TestProtocolServer(self.client)
|
||||
|
||||
def test_start_test(self):
|
||||
self.protocol.lineReceived("test old mcdonald\n")
|
||||
self.assertEqual(self.client.start_calls,
|
||||
[subunit.RemotedTestCase("old mcdonald")])
|
||||
|
||||
def test_start_testing(self):
|
||||
self.protocol.lineReceived("testing old mcdonald\n")
|
||||
self.assertEqual(self.client.start_calls,
|
||||
[subunit.RemotedTestCase("old mcdonald")])
|
||||
|
||||
def test_start_test_colon(self):
|
||||
self.protocol.lineReceived("test: old mcdonald\n")
|
||||
self.assertEqual(self.client.start_calls,
|
||||
[subunit.RemotedTestCase("old mcdonald")])
|
||||
|
||||
def test_start_testing_colon(self):
|
||||
self.protocol.lineReceived("testing: old mcdonald\n")
|
||||
self.assertEqual(self.client.start_calls,
|
||||
[subunit.RemotedTestCase("old mcdonald")])
|
||||
|
||||
|
||||
class TestTestProtocolServerPassThrough(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
from StringIO import StringIO
|
||||
self.stdout = StringIO()
|
||||
self.test = subunit.RemotedTestCase("old mcdonald")
|
||||
self.client = MockTestProtocolServerClient()
|
||||
self.protocol = subunit.TestProtocolServer(self.client, self.stdout)
|
||||
|
||||
def keywords_before_test(self):
|
||||
self.protocol.lineReceived("failure a\n")
|
||||
self.protocol.lineReceived("failure: a\n")
|
||||
self.protocol.lineReceived("error a\n")
|
||||
self.protocol.lineReceived("error: a\n")
|
||||
self.protocol.lineReceived("success a\n")
|
||||
self.protocol.lineReceived("success: a\n")
|
||||
self.protocol.lineReceived("successful a\n")
|
||||
self.protocol.lineReceived("successful: a\n")
|
||||
self.protocol.lineReceived("]\n")
|
||||
self.assertEqual(self.stdout.getvalue(), "failure a\n"
|
||||
"failure: a\n"
|
||||
"error a\n"
|
||||
"error: a\n"
|
||||
"success a\n"
|
||||
"success: a\n"
|
||||
"successful a\n"
|
||||
"successful: a\n"
|
||||
"]\n")
|
||||
|
||||
def test_keywords_before_test(self):
|
||||
self.keywords_before_test()
|
||||
self.assertEqual(self.client.start_calls, [])
|
||||
self.assertEqual(self.client.error_calls, [])
|
||||
self.assertEqual(self.client.failure_calls, [])
|
||||
self.assertEqual(self.client.success_calls, [])
|
||||
|
||||
def test_keywords_after_error(self):
|
||||
self.protocol.lineReceived("test old mcdonald\n")
|
||||
self.protocol.lineReceived("error old mcdonald\n")
|
||||
self.keywords_before_test()
|
||||
self.assertEqual(self.client.start_calls, [self.test])
|
||||
self.assertEqual(self.client.end_calls, [self.test])
|
||||
self.assertEqual(self.client.error_calls,
|
||||
[(self.test, subunit.RemoteError(""))])
|
||||
self.assertEqual(self.client.failure_calls, [])
|
||||
self.assertEqual(self.client.success_calls, [])
|
||||
|
||||
def test_keywords_after_failure(self):
|
||||
self.protocol.lineReceived("test old mcdonald\n")
|
||||
self.protocol.lineReceived("failure old mcdonald\n")
|
||||
self.keywords_before_test()
|
||||
self.assertEqual(self.client.start_calls, [self.test])
|
||||
self.assertEqual(self.client.end_calls, [self.test])
|
||||
self.assertEqual(self.client.error_calls, [])
|
||||
self.assertEqual(self.client.failure_calls,
|
||||
[(self.test, subunit.RemoteError())])
|
||||
self.assertEqual(self.client.success_calls, [])
|
||||
|
||||
def test_keywords_after_success(self):
|
||||
self.protocol.lineReceived("test old mcdonald\n")
|
||||
self.protocol.lineReceived("success old mcdonald\n")
|
||||
self.keywords_before_test()
|
||||
self.assertEqual(self.client.start_calls, [self.test])
|
||||
self.assertEqual(self.client.end_calls, [self.test])
|
||||
self.assertEqual(self.client.error_calls, [])
|
||||
self.assertEqual(self.client.failure_calls, [])
|
||||
self.assertEqual(self.client.success_calls, [self.test])
|
||||
|
||||
def test_keywords_after_test(self):
|
||||
self.protocol.lineReceived("test old mcdonald\n")
|
||||
self.protocol.lineReceived("test old mcdonald\n")
|
||||
self.protocol.lineReceived("failure a\n")
|
||||
self.protocol.lineReceived("failure: a\n")
|
||||
self.protocol.lineReceived("error a\n")
|
||||
self.protocol.lineReceived("error: a\n")
|
||||
self.protocol.lineReceived("success a\n")
|
||||
self.protocol.lineReceived("success: a\n")
|
||||
self.protocol.lineReceived("successful a\n")
|
||||
self.protocol.lineReceived("successful: a\n")
|
||||
self.protocol.lineReceived("]\n")
|
||||
self.protocol.lineReceived("failure old mcdonald\n")
|
||||
self.assertEqual(self.stdout.getvalue(), "test old mcdonald\n"
|
||||
"failure a\n"
|
||||
"failure: a\n"
|
||||
"error a\n"
|
||||
"error: a\n"
|
||||
"success a\n"
|
||||
"success: a\n"
|
||||
"successful a\n"
|
||||
"successful: a\n"
|
||||
"]\n")
|
||||
self.assertEqual(self.client.start_calls, [self.test])
|
||||
self.assertEqual(self.client.end_calls, [self.test])
|
||||
self.assertEqual(self.client.failure_calls,
|
||||
[(self.test, subunit.RemoteError())])
|
||||
self.assertEqual(self.client.error_calls, [])
|
||||
self.assertEqual(self.client.success_calls, [])
|
||||
|
||||
def test_keywords_during_failure(self):
|
||||
self.protocol.lineReceived("test old mcdonald\n")
|
||||
self.protocol.lineReceived("failure: old mcdonald [\n")
|
||||
self.protocol.lineReceived("test old mcdonald\n")
|
||||
self.protocol.lineReceived("failure a\n")
|
||||
self.protocol.lineReceived("failure: a\n")
|
||||
self.protocol.lineReceived("error a\n")
|
||||
self.protocol.lineReceived("error: a\n")
|
||||
self.protocol.lineReceived("success a\n")
|
||||
self.protocol.lineReceived("success: a\n")
|
||||
self.protocol.lineReceived("successful a\n")
|
||||
self.protocol.lineReceived("successful: a\n")
|
||||
self.protocol.lineReceived(" ]\n")
|
||||
self.protocol.lineReceived("]\n")
|
||||
self.assertEqual(self.stdout.getvalue(), "")
|
||||
self.assertEqual(self.client.start_calls, [self.test])
|
||||
self.assertEqual(self.client.failure_calls,
|
||||
[(self.test, subunit.RemoteError("test old mcdonald\n"
|
||||
"failure a\n"
|
||||
"failure: a\n"
|
||||
"error a\n"
|
||||
"error: a\n"
|
||||
"success a\n"
|
||||
"success: a\n"
|
||||
"successful a\n"
|
||||
"successful: a\n"
|
||||
"]\n"))])
|
||||
self.assertEqual(self.client.end_calls, [self.test])
|
||||
self.assertEqual(self.client.error_calls, [])
|
||||
self.assertEqual(self.client.success_calls, [])
|
||||
|
||||
def test_stdout_passthrough(self):
|
||||
"""Lines received which cannot be interpreted as any protocol action
|
||||
should be passed through to sys.stdout.
|
||||
"""
|
||||
bytes = "randombytes\n"
|
||||
self.protocol.lineReceived(bytes)
|
||||
self.assertEqual(self.stdout.getvalue(), bytes)
|
||||
|
||||
|
||||
class TestTestProtocolServerLostConnection(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.client = MockTestProtocolServerClient()
|
||||
self.protocol = subunit.TestProtocolServer(self.client)
|
||||
self.test = subunit.RemotedTestCase("old mcdonald")
|
||||
|
||||
def test_lost_connection_no_input(self):
|
||||
self.protocol.lostConnection()
|
||||
self.assertEqual(self.client.start_calls, [])
|
||||
self.assertEqual(self.client.error_calls, [])
|
||||
self.assertEqual(self.client.failure_calls, [])
|
||||
self.assertEqual(self.client.success_calls, [])
|
||||
|
||||
def test_lost_connection_after_start(self):
|
||||
self.protocol.lineReceived("test old mcdonald\n")
|
||||
self.protocol.lostConnection()
|
||||
self.assertEqual(self.client.start_calls, [self.test])
|
||||
self.assertEqual(self.client.end_calls, [self.test])
|
||||
self.assertEqual(self.client.error_calls, [
|
||||
(self.test, subunit.RemoteError("lost connection during "
|
||||
"test 'old mcdonald'"))])
|
||||
self.assertEqual(self.client.failure_calls, [])
|
||||
self.assertEqual(self.client.success_calls, [])
|
||||
|
||||
def test_lost_connected_after_error(self):
|
||||
self.protocol.lineReceived("test old mcdonald\n")
|
||||
self.protocol.lineReceived("error old mcdonald\n")
|
||||
self.protocol.lostConnection()
|
||||
self.assertEqual(self.client.start_calls, [self.test])
|
||||
self.assertEqual(self.client.failure_calls, [])
|
||||
self.assertEqual(self.client.end_calls, [self.test])
|
||||
self.assertEqual(self.client.error_calls, [
|
||||
(self.test, subunit.RemoteError(""))])
|
||||
self.assertEqual(self.client.success_calls, [])
|
||||
|
||||
def test_lost_connection_during_error(self):
|
||||
self.protocol.lineReceived("test old mcdonald\n")
|
||||
self.protocol.lineReceived("error old mcdonald [\n")
|
||||
self.protocol.lostConnection()
|
||||
self.assertEqual(self.client.start_calls, [self.test])
|
||||
self.assertEqual(self.client.end_calls, [self.test])
|
||||
self.assertEqual(self.client.error_calls, [
|
||||
(self.test, subunit.RemoteError("lost connection during error "
|
||||
"report of test 'old mcdonald'"))])
|
||||
self.assertEqual(self.client.failure_calls, [])
|
||||
self.assertEqual(self.client.success_calls, [])
|
||||
|
||||
def test_lost_connected_after_failure(self):
|
||||
self.protocol.lineReceived("test old mcdonald\n")
|
||||
self.protocol.lineReceived("failure old mcdonald\n")
|
||||
self.protocol.lostConnection()
|
||||
test = subunit.RemotedTestCase("old mcdonald")
|
||||
self.assertEqual(self.client.start_calls, [self.test])
|
||||
self.assertEqual(self.client.end_calls, [self.test])
|
||||
self.assertEqual(self.client.error_calls, [])
|
||||
self.assertEqual(self.client.failure_calls,
|
||||
[(self.test, subunit.RemoteError())])
|
||||
self.assertEqual(self.client.success_calls, [])
|
||||
|
||||
def test_lost_connection_during_failure(self):
|
||||
self.protocol.lineReceived("test old mcdonald\n")
|
||||
self.protocol.lineReceived("failure old mcdonald [\n")
|
||||
self.protocol.lostConnection()
|
||||
self.assertEqual(self.client.start_calls, [self.test])
|
||||
self.assertEqual(self.client.end_calls, [self.test])
|
||||
self.assertEqual(self.client.error_calls,
|
||||
[(self.test,
|
||||
subunit.RemoteError("lost connection during "
|
||||
"failure report"
|
||||
" of test 'old mcdonald'"))])
|
||||
self.assertEqual(self.client.failure_calls, [])
|
||||
self.assertEqual(self.client.success_calls, [])
|
||||
|
||||
def test_lost_connection_after_success(self):
|
||||
self.protocol.lineReceived("test old mcdonald\n")
|
||||
self.protocol.lineReceived("success old mcdonald\n")
|
||||
self.protocol.lostConnection()
|
||||
self.assertEqual(self.client.start_calls, [self.test])
|
||||
self.assertEqual(self.client.end_calls, [self.test])
|
||||
self.assertEqual(self.client.error_calls, [])
|
||||
self.assertEqual(self.client.failure_calls, [])
|
||||
self.assertEqual(self.client.success_calls, [self.test])
|
||||
|
||||
|
||||
class TestTestProtocolServerAddError(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.client = MockTestProtocolServerClient()
|
||||
self.protocol = subunit.TestProtocolServer(self.client)
|
||||
self.protocol.lineReceived("test mcdonalds farm\n")
|
||||
self.test = subunit.RemotedTestCase("mcdonalds farm")
|
||||
|
||||
def simple_error_keyword(self, keyword):
|
||||
self.protocol.lineReceived("%s mcdonalds farm\n" % keyword)
|
||||
self.assertEqual(self.client.start_calls, [self.test])
|
||||
self.assertEqual(self.client.end_calls, [self.test])
|
||||
self.assertEqual(self.client.error_calls, [
|
||||
(self.test, subunit.RemoteError(""))])
|
||||
self.assertEqual(self.client.failure_calls, [])
|
||||
|
||||
def test_simple_error(self):
|
||||
self.simple_error_keyword("error")
|
||||
|
||||
def test_simple_error_colon(self):
|
||||
self.simple_error_keyword("error:")
|
||||
|
||||
def test_error_empty_message(self):
|
||||
self.protocol.lineReceived("error mcdonalds farm [\n")
|
||||
self.protocol.lineReceived("]\n")
|
||||
self.assertEqual(self.client.start_calls, [self.test])
|
||||
self.assertEqual(self.client.end_calls, [self.test])
|
||||
self.assertEqual(self.client.error_calls, [
|
||||
(self.test, subunit.RemoteError(""))])
|
||||
self.assertEqual(self.client.failure_calls, [])
|
||||
|
||||
def error_quoted_bracket(self, keyword):
|
||||
self.protocol.lineReceived("%s mcdonalds farm [\n" % keyword)
|
||||
self.protocol.lineReceived(" ]\n")
|
||||
self.protocol.lineReceived("]\n")
|
||||
self.assertEqual(self.client.start_calls, [self.test])
|
||||
self.assertEqual(self.client.end_calls, [self.test])
|
||||
self.assertEqual(self.client.error_calls, [
|
||||
(self.test, subunit.RemoteError("]\n"))])
|
||||
self.assertEqual(self.client.failure_calls, [])
|
||||
|
||||
def test_error_quoted_bracket(self):
|
||||
self.error_quoted_bracket("error")
|
||||
|
||||
def test_error_colon_quoted_bracket(self):
|
||||
self.error_quoted_bracket("error:")
|
||||
|
||||
|
||||
class TestTestProtocolServerAddFailure(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.client = MockTestProtocolServerClient()
|
||||
self.protocol = subunit.TestProtocolServer(self.client)
|
||||
self.protocol.lineReceived("test mcdonalds farm\n")
|
||||
self.test = subunit.RemotedTestCase("mcdonalds farm")
|
||||
|
||||
def simple_failure_keyword(self, keyword):
|
||||
self.protocol.lineReceived("%s mcdonalds farm\n" % keyword)
|
||||
self.assertEqual(self.client.start_calls, [self.test])
|
||||
self.assertEqual(self.client.end_calls, [self.test])
|
||||
self.assertEqual(self.client.error_calls, [])
|
||||
self.assertEqual(self.client.failure_calls,
|
||||
[(self.test, subunit.RemoteError())])
|
||||
|
||||
def test_simple_failure(self):
|
||||
self.simple_failure_keyword("failure")
|
||||
|
||||
def test_simple_failure_colon(self):
|
||||
self.simple_failure_keyword("failure:")
|
||||
|
||||
def test_failure_empty_message(self):
|
||||
self.protocol.lineReceived("failure mcdonalds farm [\n")
|
||||
self.protocol.lineReceived("]\n")
|
||||
self.assertEqual(self.client.start_calls, [self.test])
|
||||
self.assertEqual(self.client.end_calls, [self.test])
|
||||
self.assertEqual(self.client.error_calls, [])
|
||||
self.assertEqual(self.client.failure_calls,
|
||||
[(self.test, subunit.RemoteError())])
|
||||
|
||||
def failure_quoted_bracket(self, keyword):
|
||||
self.protocol.lineReceived("%s mcdonalds farm [\n" % keyword)
|
||||
self.protocol.lineReceived(" ]\n")
|
||||
self.protocol.lineReceived("]\n")
|
||||
self.assertEqual(self.client.start_calls, [self.test])
|
||||
self.assertEqual(self.client.end_calls, [self.test])
|
||||
self.assertEqual(self.client.error_calls, [])
|
||||
self.assertEqual(self.client.failure_calls,
|
||||
[(self.test, subunit.RemoteError("]\n"))])
|
||||
|
||||
def test_failure_quoted_bracket(self):
|
||||
self.failure_quoted_bracket("failure")
|
||||
|
||||
def test_failure_colon_quoted_bracket(self):
|
||||
self.failure_quoted_bracket("failure:")
|
||||
|
||||
|
||||
class TestTestProtocolServerAddSuccess(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.client = MockTestProtocolServerClient()
|
||||
self.protocol = subunit.TestProtocolServer(self.client)
|
||||
self.protocol.lineReceived("test mcdonalds farm\n")
|
||||
self.test = subunit.RemotedTestCase("mcdonalds farm")
|
||||
|
||||
def simple_success_keyword(self, keyword):
|
||||
self.protocol.lineReceived("%s mcdonalds farm\n" % keyword)
|
||||
self.assertEqual(self.client.start_calls, [self.test])
|
||||
self.assertEqual(self.client.end_calls, [self.test])
|
||||
self.assertEqual(self.client.error_calls, [])
|
||||
self.assertEqual(self.client.success_calls, [self.test])
|
||||
|
||||
def test_simple_success(self):
|
||||
self.simple_success_keyword("failure")
|
||||
|
||||
def test_simple_success_colon(self):
|
||||
self.simple_success_keyword("failure:")
|
||||
|
||||
def test_simple_success(self):
|
||||
self.simple_success_keyword("successful")
|
||||
|
||||
def test_simple_success_colon(self):
|
||||
self.simple_success_keyword("successful:")
|
||||
|
||||
|
||||
class TestRemotedTestCase(unittest.TestCase):
|
||||
|
||||
def test_simple(self):
|
||||
test = subunit.RemotedTestCase("A test description")
|
||||
self.assertRaises(NotImplementedError, test.setUp)
|
||||
self.assertRaises(NotImplementedError, test.tearDown)
|
||||
self.assertEqual("A test description",
|
||||
test.shortDescription())
|
||||
self.assertEqual("subunit.RemotedTestCase.A test description",
|
||||
test.id())
|
||||
self.assertEqual("A test description (subunit.RemotedTestCase)", "%s" % test)
|
||||
self.assertEqual("<subunit.RemotedTestCase description="
|
||||
"'A test description'>", "%r" % test)
|
||||
result = unittest.TestResult()
|
||||
test.run(result)
|
||||
self.assertEqual([(test, "RemoteException: "
|
||||
"Cannot run RemotedTestCases.\n\n")],
|
||||
result.errors)
|
||||
self.assertEqual(1, result.testsRun)
|
||||
another_test = subunit.RemotedTestCase("A test description")
|
||||
self.assertEqual(test, another_test)
|
||||
different_test = subunit.RemotedTestCase("ofo")
|
||||
self.assertNotEqual(test, different_test)
|
||||
self.assertNotEqual(another_test, different_test)
|
||||
|
||||
|
||||
class TestRemoteError(unittest.TestCase):
|
||||
|
||||
def test_eq(self):
|
||||
error = subunit.RemoteError("Something went wrong")
|
||||
another_error = subunit.RemoteError("Something went wrong")
|
||||
different_error = subunit.RemoteError("boo!")
|
||||
self.assertEqual(error, another_error)
|
||||
self.assertNotEqual(error, different_error)
|
||||
self.assertNotEqual(different_error, another_error)
|
||||
|
||||
def test_empty_constructor(self):
|
||||
self.assertEqual(subunit.RemoteError(), subunit.RemoteError(""))
|
||||
|
||||
|
||||
class TestExecTestCase(unittest.TestCase):
|
||||
|
||||
class SampleExecTestCase(subunit.ExecTestCase):
|
||||
|
||||
def test_sample_method(self):
|
||||
"""sample-script.py"""
|
||||
# the sample script runs three tests, one each
|
||||
# that fails, errors and succeeds
|
||||
|
||||
|
||||
def test_construct(self):
|
||||
test = self.SampleExecTestCase("test_sample_method")
|
||||
self.assertEqual(test.script,
|
||||
subunit.join_dir(__file__, 'sample-script.py'))
|
||||
|
||||
def test_run(self):
|
||||
runner = MockTestProtocolServerClient()
|
||||
test = self.SampleExecTestCase("test_sample_method")
|
||||
test.run(runner)
|
||||
mcdonald = subunit.RemotedTestCase("old mcdonald")
|
||||
bing = subunit.RemotedTestCase("bing crosby")
|
||||
an_error = subunit.RemotedTestCase("an error")
|
||||
self.assertEqual(runner.error_calls,
|
||||
[(an_error, subunit.RemoteError())])
|
||||
self.assertEqual(runner.failure_calls,
|
||||
[(bing,
|
||||
subunit.RemoteError(
|
||||
"foo.c:53:ERROR invalid state\n"))])
|
||||
self.assertEqual(runner.start_calls, [mcdonald, bing, an_error])
|
||||
self.assertEqual(runner.end_calls, [mcdonald, bing, an_error])
|
||||
|
||||
def test_debug(self):
|
||||
test = self.SampleExecTestCase("test_sample_method")
|
||||
test.debug()
|
||||
|
||||
def test_count_test_cases(self):
|
||||
"""TODO run the child process and count responses to determine the count."""
|
||||
|
||||
def test_join_dir(self):
|
||||
sibling = subunit.join_dir(__file__, 'foo')
|
||||
expected = '%s/foo' % (os.path.split(__file__)[0],)
|
||||
self.assertEqual(sibling, expected)
|
||||
|
||||
|
||||
class DoExecTestCase(subunit.ExecTestCase):
|
||||
|
||||
def test_working_script(self):
|
||||
"""sample-two-script.py"""
|
||||
|
||||
|
||||
class TestIsolatedTestCase(unittest.TestCase):
|
||||
|
||||
class SampleIsolatedTestCase(subunit.IsolatedTestCase):
|
||||
|
||||
SETUP = False
|
||||
TEARDOWN = False
|
||||
TEST = False
|
||||
|
||||
def setUp(self):
|
||||
TestIsolatedTestCase.SampleIsolatedTestCase.SETUP = True
|
||||
|
||||
def tearDown(self):
|
||||
TestIsolatedTestCase.SampleIsolatedTestCase.TEARDOWN = True
|
||||
|
||||
def test_sets_global_state(self):
|
||||
TestIsolatedTestCase.SampleIsolatedTestCase.TEST = True
|
||||
|
||||
|
||||
def test_construct(self):
|
||||
test = self.SampleIsolatedTestCase("test_sets_global_state")
|
||||
|
||||
def test_run(self):
|
||||
result = unittest.TestResult()
|
||||
test = self.SampleIsolatedTestCase("test_sets_global_state")
|
||||
test.run(result)
|
||||
self.assertEqual(result.testsRun, 1)
|
||||
self.assertEqual(self.SampleIsolatedTestCase.SETUP, False)
|
||||
self.assertEqual(self.SampleIsolatedTestCase.TEARDOWN, False)
|
||||
self.assertEqual(self.SampleIsolatedTestCase.TEST, False)
|
||||
|
||||
def test_debug(self):
|
||||
pass
|
||||
#test = self.SampleExecTestCase("test_sample_method")
|
||||
#test.debug()
|
||||
|
||||
|
||||
class TestIsolatedTestSuite(unittest.TestCase):
|
||||
|
||||
class SampleTestToIsolate(unittest.TestCase):
|
||||
|
||||
SETUP = False
|
||||
TEARDOWN = False
|
||||
TEST = False
|
||||
|
||||
def setUp(self):
|
||||
TestIsolatedTestSuite.SampleTestToIsolate.SETUP = True
|
||||
|
||||
def tearDown(self):
|
||||
TestIsolatedTestSuite.SampleTestToIsolate.TEARDOWN = True
|
||||
|
||||
def test_sets_global_state(self):
|
||||
TestIsolatedTestSuite.SampleTestToIsolate.TEST = True
|
||||
|
||||
|
||||
def test_construct(self):
|
||||
suite = subunit.IsolatedTestSuite()
|
||||
|
||||
def test_run(self):
|
||||
result = unittest.TestResult()
|
||||
suite = subunit.IsolatedTestSuite()
|
||||
sub_suite = unittest.TestSuite()
|
||||
sub_suite.addTest(self.SampleTestToIsolate("test_sets_global_state"))
|
||||
sub_suite.addTest(self.SampleTestToIsolate("test_sets_global_state"))
|
||||
suite.addTest(sub_suite)
|
||||
suite.addTest(self.SampleTestToIsolate("test_sets_global_state"))
|
||||
suite.run(result)
|
||||
self.assertEqual(result.testsRun, 3)
|
||||
self.assertEqual(self.SampleTestToIsolate.SETUP, False)
|
||||
self.assertEqual(self.SampleTestToIsolate.TEARDOWN, False)
|
||||
self.assertEqual(self.SampleTestToIsolate.TEST, False)
|
||||
|
||||
|
||||
class TestTestProtocolClient(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.io = StringIO()
|
||||
self.protocol = subunit.TestProtocolClient(self.io)
|
||||
self.test = TestTestProtocolClient("test_start_test")
|
||||
|
||||
|
||||
def test_start_test(self):
|
||||
"""Test startTest on a TestProtocolClient."""
|
||||
self.protocol.startTest(self.test)
|
||||
self.assertEqual(self.io.getvalue(), "test: %s\n" % self.test.id())
|
||||
|
||||
def test_stop_test(self):
|
||||
"""Test stopTest on a TestProtocolClient."""
|
||||
self.protocol.stopTest(self.test)
|
||||
self.assertEqual(self.io.getvalue(), "")
|
||||
|
||||
def test_add_success(self):
|
||||
"""Test addSuccess on a TestProtocolClient."""
|
||||
self.protocol.addSuccess(self.test)
|
||||
self.assertEqual(
|
||||
self.io.getvalue(), "successful: %s\n" % self.test.id())
|
||||
|
||||
def test_add_failure(self):
|
||||
"""Test addFailure on a TestProtocolClient."""
|
||||
self.protocol.addFailure(self.test, subunit.RemoteError("boo"))
|
||||
self.assertEqual(
|
||||
self.io.getvalue(),
|
||||
'failure: %s [\nRemoteException: boo\n]\n' % self.test.id())
|
||||
|
||||
def test_add_error(self):
|
||||
"""Test stopTest on a TestProtocolClient."""
|
||||
self.protocol.addError(self.test, subunit.RemoteError("phwoar"))
|
||||
self.assertEqual(
|
||||
self.io.getvalue(),
|
||||
'error: %s [\n'
|
||||
"RemoteException: phwoar\n"
|
||||
"]\n" % self.test.id())
|
||||
|
||||
|
||||
def test_suite():
|
||||
loader = subunit.tests.TestUtil.TestLoader()
|
||||
result = loader.loadTestsFromName(__name__)
|
||||
return result
|
@ -9,6 +9,7 @@ mandir = @mandir@
|
||||
VPATH = @srcdir@:@libreplacedir@
|
||||
srcdir = @srcdir@
|
||||
builddir = @builddir@
|
||||
sharedbuilddir = @sharedbuilddir@
|
||||
XSLTPROC = @XSLTPROC@
|
||||
INSTALLCMD = @INSTALL@
|
||||
CC = @CC@
|
||||
@ -31,6 +32,15 @@ include $(tallocdir)/talloc.mk
|
||||
$(TALLOC_SOLIB): $(LIBOBJ)
|
||||
$(SHLD) $(SHLD_FLAGS) -o $@ $(LIBOBJ) @SONAMEFLAG@$(TALLOC_SONAME)
|
||||
|
||||
shared-build: all
|
||||
${INSTALLCMD} -d $(sharedbuilddir)/lib
|
||||
${INSTALLCMD} -m 644 libtalloc.a $(sharedbuilddir)/lib
|
||||
${INSTALLCMD} -m 755 $(TALLOC_SOLIB) $(sharedbuilddir)/lib
|
||||
ln -sf $(TALLOC_SOLIB) $(sharedbuilddir)/lib/$(TALLOC_SONAME)
|
||||
ln -sf $(TALLOC_SOLIB) $(sharedbuilddir)/lib/libtalloc.so
|
||||
${INSTALLCMD} -d $(sharedbuilddir)/include
|
||||
${INSTALLCMD} -m 644 $(srcdir)/talloc.h $(sharedbuilddir)/include
|
||||
|
||||
check: test
|
||||
|
||||
installcheck:: test install
|
||||
|
14
lib/talloc/build_macros.m4
Normal file
14
lib/talloc/build_macros.m4
Normal file
@ -0,0 +1,14 @@
|
||||
AC_DEFUN(BUILD_WITH_SHARED_BUILD_DIR,
|
||||
[ AC_ARG_WITH([shared-build-dir],
|
||||
[AC_HELP_STRING([--with-shared-build-dir=DIR],
|
||||
[temporary build directory where libraries are installed [$srcdir/sharedbuild]])])
|
||||
|
||||
sharedbuilddir="$srcdir/sharedbuild"
|
||||
if test x"$with_shared_build_dir" != x; then
|
||||
sharedbuilddir=$with_shared_build_dir
|
||||
CFLAGS="$CFLAGS -I$with_shared_build_dir/include"
|
||||
LDFLAGS="$LDFLAGS -L$with_shared_build_dir/lib"
|
||||
fi
|
||||
AC_SUBST(sharedbuilddir)
|
||||
])
|
||||
|
@ -21,4 +21,7 @@ AC_LD_SONAMEFLAG
|
||||
AC_LIBREPLACE_SHLD
|
||||
AC_LIBREPLACE_SHLD_FLAGS
|
||||
|
||||
m4_include(build_macros.m4)
|
||||
BUILD_WITH_SHARED_BUILD_DIR
|
||||
|
||||
AC_OUTPUT(Makefile talloc.pc)
|
||||
|
@ -5,8 +5,8 @@ TALLOC_SONAME = libtalloc.$(SHLIBEXT).1
|
||||
|
||||
all:: libtalloc.a $(TALLOC_SOLIB) testsuite
|
||||
|
||||
testsuite:: $(LIBOBJ) testsuite.o
|
||||
$(CC) $(CFLAGS) -o testsuite testsuite.o $(LIBOBJ) $(LIBS)
|
||||
testsuite:: $(LIBOBJ) testsuite.o testsuite_main.o
|
||||
$(CC) $(CFLAGS) -o testsuite testsuite.o testsuite_main.o $(LIBOBJ) $(LIBS)
|
||||
|
||||
libtalloc.a: $(LIBOBJ)
|
||||
ar -rv $@ $(LIBOBJ)
|
||||
@ -22,13 +22,13 @@ install:: all
|
||||
${INSTALLCMD} -m 644 talloc.pc $(DESTDIR)$(libdir)/pkgconfig
|
||||
if [ -f talloc.3 ];then ${INSTALLCMD} -d $(DESTDIR)$(mandir)/man3; fi
|
||||
if [ -f talloc.3 ];then ${INSTALLCMD} -m 644 talloc.3 $(DESTDIR)$(mandir)/man3; fi
|
||||
which swig >/dev/null 2>&1 && ${INSTALLCMD} -d $(DESTDIR)`swig -swiglib` || true
|
||||
which swig >/dev/null 2>&1 && ${INSTALLCMD} -m 644 talloc.i $(DESTDIR)`swig -swiglib` || true
|
||||
which swig >/dev/null 2>&1 && ${INSTALLCMD} -d $(DESTDIR)$(prefix)`swig -swiglib` || true
|
||||
which swig >/dev/null 2>&1 && ${INSTALLCMD} -m 644 talloc.i $(DESTDIR)$(prefix)`swig -swiglib` || true
|
||||
|
||||
doc:: talloc.3 talloc.3.html
|
||||
|
||||
clean::
|
||||
rm -f *~ $(LIBOBJ) $(TALLOC_SOLIB) libtalloc.a testsuite testsuite.o *.gc?? talloc.3 talloc.3.html
|
||||
rm -f *~ $(LIBOBJ) $(TALLOC_SOLIB) libtalloc.a testsuite testsuite.o testsuite_main.o *.gc?? talloc.3 talloc.3.html
|
||||
|
||||
test:: testsuite
|
||||
./testsuite
|
||||
|
@ -1,5 +1,7 @@
|
||||
Using talloc in Samba4
|
||||
----------------------
|
||||
======================
|
||||
|
||||
.. contents::
|
||||
|
||||
Andrew Tridgell
|
||||
September 2004
|
||||
@ -18,7 +20,7 @@ get used to it.
|
||||
Perhaps the biggest change from Samba3 is that there is no distinction
|
||||
between a "talloc context" and a "talloc pointer". Any pointer
|
||||
returned from talloc() is itself a valid talloc context. This means
|
||||
you can do this:
|
||||
you can do this::
|
||||
|
||||
struct foo *X = talloc(mem_ctx, struct foo);
|
||||
X->name = talloc_strdup(X, "foo");
|
||||
@ -271,7 +273,7 @@ equivalent to:
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
void *talloc_named_const(const void *context, size_t size, const char *name);
|
||||
|
||||
This is equivalent to:
|
||||
This is equivalent to::
|
||||
|
||||
ptr = talloc_size(context, size);
|
||||
talloc_set_name_const(ptr, name);
|
||||
@ -288,7 +290,7 @@ talloc_set_name() for details.
|
||||
void *talloc_init(const char *fmt, ...);
|
||||
|
||||
This function creates a zero length named talloc context as a top
|
||||
level context. It is equivalent to:
|
||||
level context. It is equivalent to::
|
||||
|
||||
talloc_named(NULL, 0, fmt, ...);
|
||||
|
||||
@ -309,7 +311,7 @@ The talloc_realloc() macro changes the size of a talloc
|
||||
pointer. The "count" argument is the number of elements of type "type"
|
||||
that you want the resulting pointer to hold.
|
||||
|
||||
talloc_realloc() has the following equivalences:
|
||||
talloc_realloc() has the following equivalences::
|
||||
|
||||
talloc_realloc(context, NULL, type, 1) ==> talloc(context, type);
|
||||
talloc_realloc(context, NULL, type, N) ==> talloc_array(context, type, N);
|
||||
@ -490,7 +492,7 @@ This disables tracking of the NULL memory context.
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
(type *)talloc_zero(const void *ctx, type);
|
||||
|
||||
The talloc_zero() macro is equivalent to:
|
||||
The talloc_zero() macro is equivalent to::
|
||||
|
||||
ptr = talloc(ctx, type);
|
||||
if (ptr) memset(ptr, 0, sizeof(type));
|
||||
@ -505,7 +507,7 @@ The talloc_zero_size() function is useful when you don't have a known type
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
void *talloc_memdup(const void *ctx, const void *p, size_t size);
|
||||
|
||||
The talloc_memdup() function is equivalent to:
|
||||
The talloc_memdup() function is equivalent to::
|
||||
|
||||
ptr = talloc_size(ctx, size);
|
||||
if (ptr) memcpy(ptr, p, size);
|
||||
@ -514,13 +516,14 @@ The talloc_memdup() function is equivalent to:
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
char *talloc_strdup(const void *ctx, const char *p);
|
||||
|
||||
The talloc_strdup() function is equivalent to:
|
||||
The talloc_strdup() function is equivalent to::
|
||||
|
||||
ptr = talloc_size(ctx, strlen(p)+1);
|
||||
if (ptr) memcpy(ptr, p, strlen(p)+1);
|
||||
|
||||
This functions sets the name of the new pointer to the passed
|
||||
string. This is equivalent to:
|
||||
string. This is equivalent to::
|
||||
|
||||
talloc_set_name_const(ptr, ptr)
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
@ -540,7 +543,8 @@ The talloc_append_string() function appends the given formatted
|
||||
string to the given string.
|
||||
|
||||
This function sets the name of the new pointer to the new
|
||||
string. This is equivalent to:
|
||||
string. This is equivalent to::
|
||||
|
||||
talloc_set_name_const(ptr, ptr)
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
@ -550,7 +554,8 @@ The talloc_vasprintf() function is the talloc equivalent of the C
|
||||
library function vasprintf()
|
||||
|
||||
This functions sets the name of the new pointer to the new
|
||||
string. This is equivalent to:
|
||||
string. This is equivalent to::
|
||||
|
||||
talloc_set_name_const(ptr, ptr)
|
||||
|
||||
|
||||
@ -561,7 +566,8 @@ The talloc_asprintf() function is the talloc equivalent of the C
|
||||
library function asprintf()
|
||||
|
||||
This functions sets the name of the new pointer to the new
|
||||
string. This is equivalent to:
|
||||
string. This is equivalent to::
|
||||
|
||||
talloc_set_name_const(ptr, ptr)
|
||||
|
||||
|
||||
@ -574,7 +580,8 @@ Use this varient when the string in the current talloc buffer may
|
||||
have been truncated in length.
|
||||
|
||||
This functions sets the name of the new pointer to the new
|
||||
string. This is equivalent to:
|
||||
string. This is equivalent to::
|
||||
|
||||
talloc_set_name_const(ptr, ptr)
|
||||
|
||||
|
||||
@ -587,14 +594,15 @@ Use this varient when the string in the current talloc buffer has
|
||||
not been changed.
|
||||
|
||||
This functions sets the name of the new pointer to the new
|
||||
string. This is equivalent to:
|
||||
string. This is equivalent to::
|
||||
|
||||
talloc_set_name_const(ptr, ptr)
|
||||
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
((type *)talloc_array(const void *ctx, type, uint_t count);
|
||||
|
||||
The talloc_array() macro is equivalent to:
|
||||
The talloc_array() macro is equivalent to::
|
||||
|
||||
(type *)talloc_size(ctx, sizeof(type) * count);
|
||||
|
||||
@ -648,7 +656,7 @@ then the pointer is returned. It it doesn't then NULL is returned.
|
||||
|
||||
This macro allows you to do type checking on talloc pointers. It is
|
||||
particularly useful for void* private pointers. It is equivalent to
|
||||
this:
|
||||
this::
|
||||
|
||||
(type *)talloc_check_name(ptr, #type)
|
||||
|
||||
@ -660,7 +668,8 @@ This macro allows you to force the name of a pointer to be a
|
||||
particular type. This can be used in conjunction with
|
||||
talloc_get_type() to do type checking on void* pointers.
|
||||
|
||||
It is equivalent to this:
|
||||
It is equivalent to this::
|
||||
|
||||
talloc_set_name_const(ptr, #type)
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
|
@ -1140,13 +1140,3 @@ bool torture_local_talloc(struct torture_context *tctx)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if _SAMBA_BUILD_ < 4
|
||||
int main(void)
|
||||
{
|
||||
bool ret = torture_local_talloc(NULL);
|
||||
if (!ret)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
37
lib/talloc/testsuite_main.c
Normal file
37
lib/talloc/testsuite_main.c
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
local testing of talloc routines.
|
||||
|
||||
Copyright (C) Andrew Tridgell 2004
|
||||
|
||||
** NOTE! The following LGPL license applies to the talloc
|
||||
** library. This does NOT imply that all of Samba is released
|
||||
** under the LGPL
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "replace.h"
|
||||
|
||||
struct torture_context;
|
||||
bool torture_local_talloc(struct torture_context *tctx);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
bool ret = torture_local_talloc(NULL);
|
||||
if (!ret)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
@ -12,6 +12,8 @@ libdir = @libdir@
|
||||
VPATH = @srcdir@:@libreplacedir@
|
||||
srcdir = @srcdir@
|
||||
builddir = @builddir@
|
||||
sharedbuilddir = @sharedbuilddir@
|
||||
INSTALLCMD = @INSTALL@
|
||||
CPPFLAGS = @CPPFLAGS@ -I$(srcdir)/include -Iinclude
|
||||
CFLAGS = $(CPPFLAGS) @CFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
@ -43,6 +45,15 @@ install:: all
|
||||
$(TDB_SOLIB): $(TDB_OBJ)
|
||||
$(SHLD) $(SHLD_FLAGS) -o $@ $(TDB_OBJ) @SONAMEFLAG@$(TDB_SONAME)
|
||||
|
||||
shared-build: all
|
||||
${INSTALLCMD} -d $(sharedbuilddir)/lib
|
||||
${INSTALLCMD} -m 644 libtdb.a $(sharedbuilddir)/lib
|
||||
${INSTALLCMD} -m 755 $(TDB_SOLIB) $(sharedbuilddir)/lib
|
||||
ln -sf $(TDB_SOLIB) $(sharedbuilddir)/lib/$(TDB_SONAME)
|
||||
ln -sf $(TDB_SOLIB) $(sharedbuilddir)/lib/libtdb.so
|
||||
${INSTALLCMD} -d $(sharedbuilddir)/include
|
||||
${INSTALLCMD} -m 644 $(srcdir)/include/tdb.h $(sharedbuilddir)/include
|
||||
|
||||
check: test
|
||||
|
||||
test:: $(PYTHON_CHECK_TARGET)
|
||||
|
14
lib/tdb/build_macros.m4
Normal file
14
lib/tdb/build_macros.m4
Normal file
@ -0,0 +1,14 @@
|
||||
AC_DEFUN(BUILD_WITH_SHARED_BUILD_DIR,
|
||||
[ AC_ARG_WITH([shared-build-dir],
|
||||
[AC_HELP_STRING([--with-shared-build-dir=DIR],
|
||||
[temporary build directory where libraries are installed [$srcdir/sharedbuild]])])
|
||||
|
||||
sharedbuilddir="$srcdir/sharedbuild"
|
||||
if test x"$with_shared_build_dir" != x; then
|
||||
sharedbuilddir=$with_shared_build_dir
|
||||
CFLAGS="$CFLAGS -I$with_shared_build_dir/include"
|
||||
LDFLAGS="$LDFLAGS -L$with_shared_build_dir/lib"
|
||||
fi
|
||||
AC_SUBST(sharedbuilddir)
|
||||
])
|
||||
|
@ -2,7 +2,7 @@ AC_PREREQ(2.50)
|
||||
AC_DEFUN([SMB_MODULE_DEFAULT], [echo -n ""])
|
||||
AC_DEFUN([SMB_LIBRARY_ENABLE], [echo -n ""])
|
||||
AC_DEFUN([SMB_ENABLE], [echo -n ""])
|
||||
AC_INIT(tdb, 1.1.2)
|
||||
AC_INIT(tdb, 1.1.3)
|
||||
AC_CONFIG_SRCDIR([common/tdb.c])
|
||||
AC_CONFIG_HEADER(include/config.h)
|
||||
AC_LIBREPLACE_ALL_CHECKS
|
||||
@ -27,4 +27,8 @@ if test -z "$PYTHON_CONFIG"; then
|
||||
PYTHON_INSTALL_TARGET=""
|
||||
PYTHON_CHECK_TARGET=""
|
||||
fi
|
||||
|
||||
m4_include(build_macros.m4)
|
||||
BUILD_WITH_SHARED_BUILD_DIR
|
||||
|
||||
AC_OUTPUT(Makefile tdb.pc)
|
||||
|
@ -30,6 +30,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "signal.h"
|
||||
|
||||
/* flags to tdb_store() */
|
||||
#define TDB_REPLACE 1 /* Unused */
|
||||
|
@ -321,3 +321,8 @@ typedef struct tdb_context {
|
||||
# TODO: any other missing methods for container types
|
||||
}
|
||||
} tdb;
|
||||
|
||||
%pythoncode {
|
||||
__docformat__ = 'restructuredText'
|
||||
open = Tdb
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
# This file was automatically generated by SWIG (http://www.swig.org).
|
||||
# Version 1.3.35
|
||||
# Version 1.3.36
|
||||
#
|
||||
# Don't modify this file, modify the SWIG interface instead.
|
||||
|
||||
@ -337,5 +337,8 @@ Tdb.name = new_instancemethod(_tdb.Tdb_name,None,Tdb)
|
||||
Tdb_swigregister = _tdb.Tdb_swigregister
|
||||
Tdb_swigregister(Tdb)
|
||||
|
||||
__docformat__ = 'restructuredText'
|
||||
open = Tdb
|
||||
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||
* Version 1.3.35
|
||||
* Version 1.3.36
|
||||
*
|
||||
* This file is not intended to be easily readable and contains a number of
|
||||
* coding conventions designed to improve portability and efficiency. Do not make
|
||||
@ -52,6 +52,12 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SWIG_MSC_UNSUPPRESS_4505
|
||||
# if defined(_MSC_VER)
|
||||
# pragma warning(disable : 4505) /* unreferenced local function has been removed */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SWIGUNUSEDPARM
|
||||
# ifdef __cplusplus
|
||||
# define SWIGUNUSEDPARM(p)
|
||||
@ -2518,7 +2524,7 @@ static swig_module_info swig_module = {swig_types, 11, 0, 0, 0, 0};
|
||||
|
||||
#define SWIG_name "_tdb"
|
||||
|
||||
#define SWIGVERSION 0x010335
|
||||
#define SWIGVERSION 0x010336
|
||||
#define SWIG_VERSION SWIGVERSION
|
||||
|
||||
|
||||
@ -2818,7 +2824,6 @@ SWIGINTERN PyObject *_wrap_new_Tdb(PyObject *SWIGUNUSEDPARM(self), PyObject *arg
|
||||
int arg3 ;
|
||||
int arg4 ;
|
||||
mode_t arg5 ;
|
||||
tdb *result = 0 ;
|
||||
int res1 ;
|
||||
char *buf1 = 0 ;
|
||||
int alloc1 = 0 ;
|
||||
@ -2838,6 +2843,7 @@ SWIGINTERN PyObject *_wrap_new_Tdb(PyObject *SWIGUNUSEDPARM(self), PyObject *arg
|
||||
char * kwnames[] = {
|
||||
(char *) "name",(char *) "hash_size",(char *) "tdb_flags",(char *) "flags",(char *) "mode", NULL
|
||||
};
|
||||
tdb *result = 0 ;
|
||||
|
||||
arg2 = 0;
|
||||
arg3 = TDB_DEFAULT;
|
||||
@ -2895,10 +2901,10 @@ fail:
|
||||
SWIGINTERN PyObject *_wrap_Tdb_error(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
tdb *arg1 = (tdb *) 0 ;
|
||||
enum TDB_ERROR result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject *swig_obj[1] ;
|
||||
enum TDB_ERROR result;
|
||||
|
||||
if (!args) SWIG_fail;
|
||||
swig_obj[0] = args;
|
||||
@ -2930,7 +2936,6 @@ SWIGINTERN PyObject *_wrap_delete_Tdb(PyObject *SWIGUNUSEDPARM(self), PyObject *
|
||||
}
|
||||
arg1 = (tdb *)(argp1);
|
||||
delete_tdb(arg1);
|
||||
|
||||
resultobj = SWIG_Py_Void();
|
||||
return resultobj;
|
||||
fail:
|
||||
@ -2941,10 +2946,10 @@ fail:
|
||||
SWIGINTERN PyObject *_wrap_Tdb_close(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
tdb *arg1 = (tdb *) 0 ;
|
||||
int result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject *swig_obj[1] ;
|
||||
int result;
|
||||
|
||||
if (!args) SWIG_fail;
|
||||
swig_obj[0] = args;
|
||||
@ -2966,7 +2971,6 @@ SWIGINTERN PyObject *_wrap_Tdb_append(PyObject *SWIGUNUSEDPARM(self), PyObject *
|
||||
tdb *arg1 = (tdb *) 0 ;
|
||||
TDB_DATA arg2 ;
|
||||
TDB_DATA arg3 ;
|
||||
int result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject * obj0 = 0 ;
|
||||
@ -2975,6 +2979,7 @@ SWIGINTERN PyObject *_wrap_Tdb_append(PyObject *SWIGUNUSEDPARM(self), PyObject *
|
||||
char * kwnames[] = {
|
||||
(char *) "self",(char *) "key",(char *) "new_dbuf", NULL
|
||||
};
|
||||
int result;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Tdb_append",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
|
||||
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
|
||||
@ -3013,10 +3018,10 @@ fail:
|
||||
SWIGINTERN PyObject *_wrap_Tdb_errorstr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
tdb *arg1 = (tdb *) 0 ;
|
||||
char *result = 0 ;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject *swig_obj[1] ;
|
||||
char *result = 0 ;
|
||||
|
||||
if (!args) SWIG_fail;
|
||||
swig_obj[0] = args;
|
||||
@ -3037,7 +3042,6 @@ SWIGINTERN PyObject *_wrap_Tdb_get(PyObject *SWIGUNUSEDPARM(self), PyObject *arg
|
||||
PyObject *resultobj = 0;
|
||||
tdb *arg1 = (tdb *) 0 ;
|
||||
TDB_DATA arg2 ;
|
||||
TDB_DATA result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject * obj0 = 0 ;
|
||||
@ -3045,6 +3049,7 @@ SWIGINTERN PyObject *_wrap_Tdb_get(PyObject *SWIGUNUSEDPARM(self), PyObject *arg
|
||||
char * kwnames[] = {
|
||||
(char *) "self",(char *) "key", NULL
|
||||
};
|
||||
TDB_DATA result;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Tdb_get",kwnames,&obj0,&obj1)) SWIG_fail;
|
||||
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
|
||||
@ -3079,7 +3084,6 @@ SWIGINTERN PyObject *_wrap_Tdb_delete(PyObject *SWIGUNUSEDPARM(self), PyObject *
|
||||
PyObject *resultobj = 0;
|
||||
tdb *arg1 = (tdb *) 0 ;
|
||||
TDB_DATA arg2 ;
|
||||
int result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject * obj0 = 0 ;
|
||||
@ -3087,6 +3091,7 @@ SWIGINTERN PyObject *_wrap_Tdb_delete(PyObject *SWIGUNUSEDPARM(self), PyObject *
|
||||
char * kwnames[] = {
|
||||
(char *) "self",(char *) "key", NULL
|
||||
};
|
||||
int result;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Tdb_delete",kwnames,&obj0,&obj1)) SWIG_fail;
|
||||
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
|
||||
@ -3118,7 +3123,6 @@ SWIGINTERN PyObject *_wrap_Tdb_store(PyObject *SWIGUNUSEDPARM(self), PyObject *a
|
||||
TDB_DATA arg2 ;
|
||||
TDB_DATA arg3 ;
|
||||
int arg4 ;
|
||||
int result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
int val4 ;
|
||||
@ -3130,6 +3134,7 @@ SWIGINTERN PyObject *_wrap_Tdb_store(PyObject *SWIGUNUSEDPARM(self), PyObject *a
|
||||
char * kwnames[] = {
|
||||
(char *) "self",(char *) "key",(char *) "dbuf",(char *) "flag", NULL
|
||||
};
|
||||
int result;
|
||||
|
||||
arg4 = TDB_REPLACE;
|
||||
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:Tdb_store",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
|
||||
@ -3177,7 +3182,6 @@ SWIGINTERN PyObject *_wrap_Tdb_exists(PyObject *SWIGUNUSEDPARM(self), PyObject *
|
||||
PyObject *resultobj = 0;
|
||||
tdb *arg1 = (tdb *) 0 ;
|
||||
TDB_DATA arg2 ;
|
||||
int result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject * obj0 = 0 ;
|
||||
@ -3185,6 +3189,7 @@ SWIGINTERN PyObject *_wrap_Tdb_exists(PyObject *SWIGUNUSEDPARM(self), PyObject *
|
||||
char * kwnames[] = {
|
||||
(char *) "self",(char *) "key", NULL
|
||||
};
|
||||
int result;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Tdb_exists",kwnames,&obj0,&obj1)) SWIG_fail;
|
||||
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
|
||||
@ -3213,10 +3218,10 @@ fail:
|
||||
SWIGINTERN PyObject *_wrap_Tdb_firstkey(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
tdb *arg1 = (tdb *) 0 ;
|
||||
TDB_DATA result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject *swig_obj[1] ;
|
||||
TDB_DATA result;
|
||||
|
||||
if (!args) SWIG_fail;
|
||||
swig_obj[0] = args;
|
||||
@ -3242,7 +3247,6 @@ SWIGINTERN PyObject *_wrap_Tdb_nextkey(PyObject *SWIGUNUSEDPARM(self), PyObject
|
||||
PyObject *resultobj = 0;
|
||||
tdb *arg1 = (tdb *) 0 ;
|
||||
TDB_DATA arg2 ;
|
||||
TDB_DATA result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject * obj0 = 0 ;
|
||||
@ -3250,6 +3254,7 @@ SWIGINTERN PyObject *_wrap_Tdb_nextkey(PyObject *SWIGUNUSEDPARM(self), PyObject
|
||||
char * kwnames[] = {
|
||||
(char *) "self",(char *) "key", NULL
|
||||
};
|
||||
TDB_DATA result;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Tdb_nextkey",kwnames,&obj0,&obj1)) SWIG_fail;
|
||||
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
|
||||
@ -3283,10 +3288,10 @@ fail:
|
||||
SWIGINTERN PyObject *_wrap_Tdb_lock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
tdb *arg1 = (tdb *) 0 ;
|
||||
int result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject *swig_obj[1] ;
|
||||
int result;
|
||||
|
||||
if (!args) SWIG_fail;
|
||||
swig_obj[0] = args;
|
||||
@ -3306,10 +3311,10 @@ fail:
|
||||
SWIGINTERN PyObject *_wrap_Tdb_unlock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
tdb *arg1 = (tdb *) 0 ;
|
||||
int result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject *swig_obj[1] ;
|
||||
int result;
|
||||
|
||||
if (!args) SWIG_fail;
|
||||
swig_obj[0] = args;
|
||||
@ -3329,10 +3334,10 @@ fail:
|
||||
SWIGINTERN PyObject *_wrap_Tdb_read_lock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
tdb *arg1 = (tdb *) 0 ;
|
||||
int result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject *swig_obj[1] ;
|
||||
int result;
|
||||
|
||||
if (!args) SWIG_fail;
|
||||
swig_obj[0] = args;
|
||||
@ -3352,10 +3357,10 @@ fail:
|
||||
SWIGINTERN PyObject *_wrap_Tdb_read_unlock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
tdb *arg1 = (tdb *) 0 ;
|
||||
int result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject *swig_obj[1] ;
|
||||
int result;
|
||||
|
||||
if (!args) SWIG_fail;
|
||||
swig_obj[0] = args;
|
||||
@ -3375,10 +3380,10 @@ fail:
|
||||
SWIGINTERN PyObject *_wrap_Tdb_reopen(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
tdb *arg1 = (tdb *) 0 ;
|
||||
int result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject *swig_obj[1] ;
|
||||
int result;
|
||||
|
||||
if (!args) SWIG_fail;
|
||||
swig_obj[0] = args;
|
||||
@ -3398,10 +3403,10 @@ fail:
|
||||
SWIGINTERN PyObject *_wrap_Tdb_transaction_start(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
tdb *arg1 = (tdb *) 0 ;
|
||||
int result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject *swig_obj[1] ;
|
||||
int result;
|
||||
|
||||
if (!args) SWIG_fail;
|
||||
swig_obj[0] = args;
|
||||
@ -3421,10 +3426,10 @@ fail:
|
||||
SWIGINTERN PyObject *_wrap_Tdb_transaction_commit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
tdb *arg1 = (tdb *) 0 ;
|
||||
int result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject *swig_obj[1] ;
|
||||
int result;
|
||||
|
||||
if (!args) SWIG_fail;
|
||||
swig_obj[0] = args;
|
||||
@ -3444,10 +3449,10 @@ fail:
|
||||
SWIGINTERN PyObject *_wrap_Tdb_transaction_cancel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
tdb *arg1 = (tdb *) 0 ;
|
||||
int result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject *swig_obj[1] ;
|
||||
int result;
|
||||
|
||||
if (!args) SWIG_fail;
|
||||
swig_obj[0] = args;
|
||||
@ -3467,10 +3472,10 @@ fail:
|
||||
SWIGINTERN PyObject *_wrap_Tdb_transaction_recover(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
tdb *arg1 = (tdb *) 0 ;
|
||||
int result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject *swig_obj[1] ;
|
||||
int result;
|
||||
|
||||
if (!args) SWIG_fail;
|
||||
swig_obj[0] = args;
|
||||
@ -3490,10 +3495,10 @@ fail:
|
||||
SWIGINTERN PyObject *_wrap_Tdb_hash_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
tdb *arg1 = (tdb *) 0 ;
|
||||
int result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject *swig_obj[1] ;
|
||||
int result;
|
||||
|
||||
if (!args) SWIG_fail;
|
||||
swig_obj[0] = args;
|
||||
@ -3513,10 +3518,10 @@ fail:
|
||||
SWIGINTERN PyObject *_wrap_Tdb_map_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
tdb *arg1 = (tdb *) 0 ;
|
||||
size_t result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject *swig_obj[1] ;
|
||||
size_t result;
|
||||
|
||||
if (!args) SWIG_fail;
|
||||
swig_obj[0] = args;
|
||||
@ -3536,10 +3541,10 @@ fail:
|
||||
SWIGINTERN PyObject *_wrap_Tdb_get_flags(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
tdb *arg1 = (tdb *) 0 ;
|
||||
int result;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject *swig_obj[1] ;
|
||||
int result;
|
||||
|
||||
if (!args) SWIG_fail;
|
||||
swig_obj[0] = args;
|
||||
@ -3592,10 +3597,10 @@ fail:
|
||||
SWIGINTERN PyObject *_wrap_Tdb_name(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
tdb *arg1 = (tdb *) 0 ;
|
||||
char *result = 0 ;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject *swig_obj[1] ;
|
||||
char *result = 0 ;
|
||||
|
||||
if (!args) SWIG_fail;
|
||||
swig_obj[0] = args;
|
||||
|
@ -83,7 +83,7 @@ struct nbt_name_request {
|
||||
/* information on what to do on completion */
|
||||
struct {
|
||||
void (*fn)(struct nbt_name_request *);
|
||||
void *_private;
|
||||
void *private_data;
|
||||
} async;
|
||||
};
|
||||
|
||||
@ -95,9 +95,8 @@ struct nbt_name_request {
|
||||
struct nbt_name_socket {
|
||||
struct socket_context *sock;
|
||||
struct event_context *event_ctx;
|
||||
/*
|
||||
struct smb_iconv_convenience *iconv_convenience;
|
||||
*/
|
||||
|
||||
/* a queue of requests pending to be sent */
|
||||
struct nbt_name_request *send_queue;
|
||||
|
||||
@ -114,14 +113,14 @@ struct nbt_name_socket {
|
||||
struct {
|
||||
void (*handler)(struct nbt_name_socket *, struct nbt_name_packet *,
|
||||
struct socket_address *);
|
||||
void *_private;
|
||||
void *private_data;
|
||||
} incoming;
|
||||
|
||||
/* what to do with unexpected replies */
|
||||
struct {
|
||||
void (*handler)(struct nbt_name_socket *, struct nbt_name_packet *,
|
||||
struct socket_address *);
|
||||
void *_private;
|
||||
void *private_data;
|
||||
} unexpected;
|
||||
};
|
||||
|
||||
@ -276,9 +275,8 @@ struct nbt_name_release {
|
||||
};
|
||||
|
||||
struct nbt_name_socket *nbt_name_socket_init(TALLOC_CTX *mem_ctx,
|
||||
struct event_context *event_ctx);
|
||||
/*,
|
||||
struct smb_iconv_convenience *iconv_convenience);*/
|
||||
struct event_context *event_ctx,
|
||||
struct smb_iconv_convenience *iconv_convenience);
|
||||
struct nbt_name_request *nbt_name_query_send(struct nbt_name_socket *nbtsock,
|
||||
struct nbt_name_query *io);
|
||||
NTSTATUS nbt_name_query_recv(struct nbt_name_request *req,
|
||||
@ -293,7 +291,7 @@ NTSTATUS nbt_name_status(struct nbt_name_socket *nbtsock,
|
||||
TALLOC_CTX *mem_ctx, struct nbt_name_status *io);
|
||||
|
||||
NTSTATUS nbt_name_dup(TALLOC_CTX *mem_ctx, struct nbt_name *name, struct nbt_name *newname);
|
||||
NTSTATUS nbt_name_to_blob(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct nbt_name *name);
|
||||
NTSTATUS nbt_name_to_blob(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, DATA_BLOB *blob, struct nbt_name *name);
|
||||
NTSTATUS nbt_name_from_blob(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, struct nbt_name *name);
|
||||
void nbt_choose_called_name(TALLOC_CTX *mem_ctx, struct nbt_name *n, const char *name, int type);
|
||||
char *nbt_name_string(TALLOC_CTX *mem_ctx, const struct nbt_name *name);
|
||||
@ -325,7 +323,7 @@ NTSTATUS nbt_name_refresh_recv(struct nbt_name_request *req,
|
||||
NTSTATUS nbt_set_incoming_handler(struct nbt_name_socket *nbtsock,
|
||||
void (*handler)(struct nbt_name_socket *, struct nbt_name_packet *,
|
||||
struct socket_address *),
|
||||
void *_private);
|
||||
void *private_data);
|
||||
NTSTATUS nbt_name_reply_send(struct nbt_name_socket *nbtsock,
|
||||
struct socket_address *dest,
|
||||
struct nbt_name_packet *request);
|
@ -1,27 +1,27 @@
|
||||
/*
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
make nbt name query requests
|
||||
|
||||
Copyright (C) Andrew Tridgell 2005
|
||||
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include "libcli/nbt/libnbt.h"
|
||||
#include "libcli/nbt/nbt_proto.h"
|
||||
#include "../libcli/nbt/libnbt.h"
|
||||
#include "../libcli/nbt/nbt_proto.h"
|
||||
#include "lib/socket/socket.h"
|
||||
#include "param/param.h"
|
||||
|
||||
@ -66,13 +66,13 @@ _PUBLIC_ struct nbt_name_request *nbt_name_query_send(struct nbt_name_socket *nb
|
||||
|
||||
failed:
|
||||
talloc_free(packet);
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
wait for a name query reply
|
||||
*/
|
||||
_PUBLIC_ NTSTATUS nbt_name_query_recv(struct nbt_name_request *req,
|
||||
_PUBLIC_ NTSTATUS nbt_name_query_recv(struct nbt_name_request *req,
|
||||
TALLOC_CTX *mem_ctx, struct nbt_name_query *io)
|
||||
{
|
||||
NTSTATUS status;
|
||||
@ -85,7 +85,7 @@ _PUBLIC_ NTSTATUS nbt_name_query_recv(struct nbt_name_request *req,
|
||||
talloc_free(req);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
packet = req->replies[0].packet;
|
||||
io->out.reply_from = talloc_steal(mem_ctx, req->replies[0].dest->addr);
|
||||
|
||||
@ -109,16 +109,16 @@ _PUBLIC_ NTSTATUS nbt_name_query_recv(struct nbt_name_request *req,
|
||||
talloc_free(req);
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
|
||||
for (i=0;i<io->out.num_addrs;i++) {
|
||||
io->out.reply_addrs[i] = talloc_steal(io->out.reply_addrs,
|
||||
io->out.reply_addrs[i] = talloc_steal(io->out.reply_addrs,
|
||||
packet->answers[0].rdata.netbios.addresses[i].ipaddr);
|
||||
}
|
||||
io->out.reply_addrs[i] = NULL;
|
||||
|
||||
talloc_steal(mem_ctx, io->out.name.name);
|
||||
talloc_steal(mem_ctx, io->out.name.scope);
|
||||
|
||||
|
||||
talloc_free(req);
|
||||
|
||||
return NT_STATUS_OK;
|
||||
@ -127,7 +127,7 @@ _PUBLIC_ NTSTATUS nbt_name_query_recv(struct nbt_name_request *req,
|
||||
/**
|
||||
wait for a name query reply
|
||||
*/
|
||||
_PUBLIC_ NTSTATUS nbt_name_query(struct nbt_name_socket *nbtsock,
|
||||
_PUBLIC_ NTSTATUS nbt_name_query(struct nbt_name_socket *nbtsock,
|
||||
TALLOC_CTX *mem_ctx, struct nbt_name_query *io)
|
||||
{
|
||||
struct nbt_name_request *req = nbt_name_query_send(nbtsock, io);
|
||||
@ -170,13 +170,13 @@ _PUBLIC_ struct nbt_name_request *nbt_name_status_send(struct nbt_name_socket *n
|
||||
|
||||
failed:
|
||||
talloc_free(packet);
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
wait for a name status reply
|
||||
*/
|
||||
_PUBLIC_ NTSTATUS nbt_name_status_recv(struct nbt_name_request *req,
|
||||
_PUBLIC_ NTSTATUS nbt_name_status_recv(struct nbt_name_request *req,
|
||||
TALLOC_CTX *mem_ctx, struct nbt_name_status *io)
|
||||
{
|
||||
NTSTATUS status;
|
||||
@ -189,7 +189,7 @@ _PUBLIC_ NTSTATUS nbt_name_status_recv(struct nbt_name_request *req,
|
||||
talloc_free(req);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
packet = req->replies[0].packet;
|
||||
io->out.reply_from = talloc_steal(mem_ctx, req->replies[0].dest->addr);
|
||||
|
||||
@ -216,7 +216,7 @@ _PUBLIC_ NTSTATUS nbt_name_status_recv(struct nbt_name_request *req,
|
||||
talloc_steal(io->out.status.names, io->out.status.names[i].name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
talloc_free(req);
|
||||
|
||||
return NT_STATUS_OK;
|
||||
@ -225,7 +225,7 @@ _PUBLIC_ NTSTATUS nbt_name_status_recv(struct nbt_name_request *req,
|
||||
/**
|
||||
wait for a name status reply
|
||||
*/
|
||||
_PUBLIC_ NTSTATUS nbt_name_status(struct nbt_name_socket *nbtsock,
|
||||
_PUBLIC_ NTSTATUS nbt_name_status(struct nbt_name_socket *nbtsock,
|
||||
TALLOC_CTX *mem_ctx, struct nbt_name_status *io)
|
||||
{
|
||||
struct nbt_name_request *req = nbt_name_status_send(nbtsock, io);
|
@ -1,27 +1,27 @@
|
||||
/*
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
send out a name refresh request
|
||||
|
||||
Copyright (C) Andrew Tridgell 2005
|
||||
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include "libcli/nbt/libnbt.h"
|
||||
#include "libcli/nbt/nbt_proto.h"
|
||||
#include "../libcli/nbt/libnbt.h"
|
||||
#include "../libcli/nbt/nbt_proto.h"
|
||||
#include "libcli/composite/composite.h"
|
||||
#include "lib/socket/socket.h"
|
||||
#include "param/param.h"
|
||||
@ -65,11 +65,11 @@ struct nbt_name_request *nbt_name_refresh_send(struct nbt_name_socket *nbtsock,
|
||||
struct nbt_rdata_address, 1);
|
||||
if (packet->additional[0].rdata.netbios.addresses == NULL) goto failed;
|
||||
packet->additional[0].rdata.netbios.addresses[0].nb_flags = io->in.nb_flags;
|
||||
packet->additional[0].rdata.netbios.addresses[0].ipaddr =
|
||||
packet->additional[0].rdata.netbios.addresses[0].ipaddr =
|
||||
talloc_strdup(packet->additional, io->in.address);
|
||||
|
||||
dest = socket_address_from_strings(nbtsock,
|
||||
nbtsock->sock->backend_name,
|
||||
dest = socket_address_from_strings(nbtsock,
|
||||
nbtsock->sock->backend_name,
|
||||
io->in.dest_addr, io->in.dest_port);
|
||||
if (dest == NULL) goto failed;
|
||||
req = nbt_name_request_send(nbtsock, dest, packet,
|
||||
@ -81,13 +81,13 @@ struct nbt_name_request *nbt_name_refresh_send(struct nbt_name_socket *nbtsock,
|
||||
|
||||
failed:
|
||||
talloc_free(packet);
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
wait for a refresh reply
|
||||
*/
|
||||
_PUBLIC_ NTSTATUS nbt_name_refresh_recv(struct nbt_name_request *req,
|
||||
_PUBLIC_ NTSTATUS nbt_name_refresh_recv(struct nbt_name_request *req,
|
||||
TALLOC_CTX *mem_ctx, struct nbt_name_refresh *io)
|
||||
{
|
||||
NTSTATUS status;
|
||||
@ -99,7 +99,7 @@ _PUBLIC_ NTSTATUS nbt_name_refresh_recv(struct nbt_name_request *req,
|
||||
talloc_free(req);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
packet = req->replies[0].packet;
|
||||
io->out.reply_from = talloc_steal(mem_ctx, req->replies[0].dest->addr);
|
||||
|
||||
@ -116,7 +116,7 @@ _PUBLIC_ NTSTATUS nbt_name_refresh_recv(struct nbt_name_request *req,
|
||||
talloc_free(req);
|
||||
return NT_STATUS_INVALID_NETWORK_RESPONSE;
|
||||
}
|
||||
io->out.reply_addr = talloc_steal(mem_ctx,
|
||||
io->out.reply_addr = talloc_steal(mem_ctx,
|
||||
packet->answers[0].rdata.netbios.addresses[0].ipaddr);
|
||||
talloc_steal(mem_ctx, io->out.name.name);
|
||||
talloc_steal(mem_ctx, io->out.name.scope);
|
||||
@ -129,7 +129,7 @@ _PUBLIC_ NTSTATUS nbt_name_refresh_recv(struct nbt_name_request *req,
|
||||
/*
|
||||
synchronous name refresh request
|
||||
*/
|
||||
_PUBLIC_ NTSTATUS nbt_name_refresh(struct nbt_name_socket *nbtsock,
|
||||
_PUBLIC_ NTSTATUS nbt_name_refresh(struct nbt_name_socket *nbtsock,
|
||||
TALLOC_CTX *mem_ctx, struct nbt_name_refresh *io)
|
||||
{
|
||||
struct nbt_name_request *req = nbt_name_refresh_send(nbtsock, io);
|
||||
@ -159,9 +159,9 @@ struct refresh_wins_state {
|
||||
*/
|
||||
static void name_refresh_wins_handler(struct nbt_name_request *req)
|
||||
{
|
||||
struct composite_context *c = talloc_get_type(req->async.private,
|
||||
struct composite_context *c = talloc_get_type(req->async.private_data,
|
||||
struct composite_context);
|
||||
struct refresh_wins_state *state = talloc_get_type(c->private_data,
|
||||
struct refresh_wins_state *state = talloc_get_type(c->private_data,
|
||||
struct refresh_wins_state);
|
||||
NTSTATUS status;
|
||||
|
||||
@ -184,7 +184,7 @@ static void name_refresh_wins_handler(struct nbt_name_request *req)
|
||||
c->status = NT_STATUS_NO_MEMORY;
|
||||
} else {
|
||||
state->req->async.fn = name_refresh_wins_handler;
|
||||
state->req->async.private = c;
|
||||
state->req->async.private_data = c;
|
||||
}
|
||||
} else if (!NT_STATUS_IS_OK(status)) {
|
||||
c->state = COMPOSITE_STATE_ERROR;
|
||||
@ -200,7 +200,7 @@ static void name_refresh_wins_handler(struct nbt_name_request *req)
|
||||
c->status = NT_STATUS_NO_MEMORY;
|
||||
} else {
|
||||
state->req->async.fn = name_refresh_wins_handler;
|
||||
state->req->async.private = c;
|
||||
state->req->async.private_data = c;
|
||||
}
|
||||
} else {
|
||||
c->state = COMPOSITE_STATE_DONE;
|
||||
@ -235,11 +235,11 @@ _PUBLIC_ struct composite_context *nbt_name_refresh_wins_send(struct nbt_name_so
|
||||
|
||||
state->wins_port = io->in.wins_port;
|
||||
state->wins_servers = str_list_copy(state, io->in.wins_servers);
|
||||
if (state->wins_servers == NULL ||
|
||||
if (state->wins_servers == NULL ||
|
||||
state->wins_servers[0] == NULL) goto failed;
|
||||
|
||||
state->addresses = str_list_copy(state, io->in.addresses);
|
||||
if (state->addresses == NULL ||
|
||||
if (state->addresses == NULL ||
|
||||
state->addresses[0] == NULL) goto failed;
|
||||
|
||||
state->io->in.name = io->in.name;
|
||||
@ -259,7 +259,7 @@ _PUBLIC_ struct composite_context *nbt_name_refresh_wins_send(struct nbt_name_so
|
||||
if (state->req == NULL) goto failed;
|
||||
|
||||
state->req->async.fn = name_refresh_wins_handler;
|
||||
state->req->async.private = c;
|
||||
state->req->async.private_data = c;
|
||||
|
||||
c->private_data = state;
|
||||
c->state = COMPOSITE_STATE_IN_PROGRESS;
|
||||
@ -281,7 +281,7 @@ _PUBLIC_ NTSTATUS nbt_name_refresh_wins_recv(struct composite_context *c, TALLOC
|
||||
NTSTATUS status;
|
||||
status = composite_wait(c);
|
||||
if (NT_STATUS_IS_OK(status)) {
|
||||
struct refresh_wins_state *state =
|
||||
struct refresh_wins_state *state =
|
||||
talloc_get_type(c->private_data, struct refresh_wins_state);
|
||||
io->out.wins_server = talloc_steal(mem_ctx, state->wins_servers[0]);
|
||||
io->out.rcode = state->io->out.rcode;
|
@ -1,27 +1,27 @@
|
||||
/*
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
send out a name registration request
|
||||
|
||||
Copyright (C) Andrew Tridgell 2005
|
||||
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include "libcli/nbt/libnbt.h"
|
||||
#include "libcli/nbt/nbt_proto.h"
|
||||
#include "../libcli/nbt/libnbt.h"
|
||||
#include "../libcli/nbt/nbt_proto.h"
|
||||
#include "libcli/composite/composite.h"
|
||||
#include "lib/socket/socket.h"
|
||||
#include "librpc/gen_ndr/ndr_nbt.h"
|
||||
@ -73,11 +73,11 @@ struct nbt_name_request *nbt_name_register_send(struct nbt_name_socket *nbtsock,
|
||||
struct nbt_rdata_address, 1);
|
||||
if (packet->additional[0].rdata.netbios.addresses == NULL) goto failed;
|
||||
packet->additional[0].rdata.netbios.addresses[0].nb_flags = io->in.nb_flags;
|
||||
packet->additional[0].rdata.netbios.addresses[0].ipaddr =
|
||||
packet->additional[0].rdata.netbios.addresses[0].ipaddr =
|
||||
talloc_strdup(packet->additional, io->in.address);
|
||||
if (packet->additional[0].rdata.netbios.addresses[0].ipaddr == NULL) goto failed;
|
||||
|
||||
dest = socket_address_from_strings(packet, nbtsock->sock->backend_name,
|
||||
dest = socket_address_from_strings(packet, nbtsock->sock->backend_name,
|
||||
io->in.dest_addr, io->in.dest_port);
|
||||
if (dest == NULL) goto failed;
|
||||
req = nbt_name_request_send(nbtsock, dest, packet,
|
||||
@ -89,13 +89,13 @@ struct nbt_name_request *nbt_name_register_send(struct nbt_name_socket *nbtsock,
|
||||
|
||||
failed:
|
||||
talloc_free(packet);
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
wait for a registration reply
|
||||
*/
|
||||
_PUBLIC_ NTSTATUS nbt_name_register_recv(struct nbt_name_request *req,
|
||||
_PUBLIC_ NTSTATUS nbt_name_register_recv(struct nbt_name_request *req,
|
||||
TALLOC_CTX *mem_ctx, struct nbt_name_register *io)
|
||||
{
|
||||
NTSTATUS status;
|
||||
@ -107,7 +107,7 @@ _PUBLIC_ NTSTATUS nbt_name_register_recv(struct nbt_name_request *req,
|
||||
talloc_free(req);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
packet = req->replies[0].packet;
|
||||
io->out.reply_from = talloc_steal(mem_ctx, req->replies[0].dest->addr);
|
||||
|
||||
@ -124,11 +124,11 @@ _PUBLIC_ NTSTATUS nbt_name_register_recv(struct nbt_name_request *req,
|
||||
talloc_free(req);
|
||||
return NT_STATUS_INVALID_NETWORK_RESPONSE;
|
||||
}
|
||||
io->out.reply_addr = talloc_steal(mem_ctx,
|
||||
io->out.reply_addr = talloc_steal(mem_ctx,
|
||||
packet->answers[0].rdata.netbios.addresses[0].ipaddr);
|
||||
talloc_steal(mem_ctx, io->out.name.name);
|
||||
talloc_steal(mem_ctx, io->out.name.scope);
|
||||
|
||||
|
||||
talloc_free(req);
|
||||
|
||||
return NT_STATUS_OK;
|
||||
@ -137,7 +137,7 @@ _PUBLIC_ NTSTATUS nbt_name_register_recv(struct nbt_name_request *req,
|
||||
/*
|
||||
synchronous name registration request
|
||||
*/
|
||||
_PUBLIC_ NTSTATUS nbt_name_register(struct nbt_name_socket *nbtsock,
|
||||
_PUBLIC_ NTSTATUS nbt_name_register(struct nbt_name_socket *nbtsock,
|
||||
TALLOC_CTX *mem_ctx, struct nbt_name_register *io)
|
||||
{
|
||||
struct nbt_name_request *req = nbt_name_register_send(nbtsock, io);
|
||||
@ -161,7 +161,7 @@ struct register_bcast_state {
|
||||
*/
|
||||
static void name_register_bcast_handler(struct nbt_name_request *req)
|
||||
{
|
||||
struct composite_context *c = talloc_get_type(req->async.private, struct composite_context);
|
||||
struct composite_context *c = talloc_get_type(req->async.private_data, struct composite_context);
|
||||
struct register_bcast_state *state = talloc_get_type(c->private_data, struct register_bcast_state);
|
||||
NTSTATUS status;
|
||||
|
||||
@ -183,7 +183,7 @@ static void name_register_bcast_handler(struct nbt_name_request *req)
|
||||
c->status = NT_STATUS_NO_MEMORY;
|
||||
} else {
|
||||
state->req->async.fn = name_register_bcast_handler;
|
||||
state->req->async.private = c;
|
||||
state->req->async.private_data = c;
|
||||
}
|
||||
} else if (!NT_STATUS_IS_OK(status)) {
|
||||
c->state = COMPOSITE_STATE_ERROR;
|
||||
@ -192,7 +192,7 @@ static void name_register_bcast_handler(struct nbt_name_request *req)
|
||||
c->state = COMPOSITE_STATE_ERROR;
|
||||
c->status = NT_STATUS_CONFLICTING_ADDRESSES;
|
||||
DEBUG(3,("Name registration conflict from %s for %s with ip %s - rcode %d\n",
|
||||
state->io->out.reply_from,
|
||||
state->io->out.reply_from,
|
||||
nbt_name_string(state, &state->io->out.name),
|
||||
state->io->out.reply_addr,
|
||||
state->io->out.rcode));
|
||||
@ -241,7 +241,7 @@ _PUBLIC_ struct composite_context *nbt_name_register_bcast_send(struct nbt_name_
|
||||
if (state->req == NULL) goto failed;
|
||||
|
||||
state->req->async.fn = name_register_bcast_handler;
|
||||
state->req->async.private = c;
|
||||
state->req->async.private_data = c;
|
||||
|
||||
c->private_data = state;
|
||||
c->state = COMPOSITE_STATE_IN_PROGRESS;
|
||||
@ -297,9 +297,9 @@ struct register_wins_state {
|
||||
*/
|
||||
static void name_register_wins_handler(struct nbt_name_request *req)
|
||||
{
|
||||
struct composite_context *c = talloc_get_type(req->async.private,
|
||||
struct composite_context *c = talloc_get_type(req->async.private_data,
|
||||
struct composite_context);
|
||||
struct register_wins_state *state = talloc_get_type(c->private_data,
|
||||
struct register_wins_state *state = talloc_get_type(c->private_data,
|
||||
struct register_wins_state);
|
||||
NTSTATUS status;
|
||||
|
||||
@ -322,7 +322,7 @@ static void name_register_wins_handler(struct nbt_name_request *req)
|
||||
c->status = NT_STATUS_NO_MEMORY;
|
||||
} else {
|
||||
state->req->async.fn = name_register_wins_handler;
|
||||
state->req->async.private = c;
|
||||
state->req->async.private_data = c;
|
||||
}
|
||||
} else if (!NT_STATUS_IS_OK(status)) {
|
||||
c->state = COMPOSITE_STATE_ERROR;
|
||||
@ -338,7 +338,7 @@ static void name_register_wins_handler(struct nbt_name_request *req)
|
||||
c->status = NT_STATUS_NO_MEMORY;
|
||||
} else {
|
||||
state->req->async.fn = name_register_wins_handler;
|
||||
state->req->async.private = c;
|
||||
state->req->async.private_data = c;
|
||||
}
|
||||
} else {
|
||||
c->state = COMPOSITE_STATE_DONE;
|
||||
@ -373,11 +373,11 @@ _PUBLIC_ struct composite_context *nbt_name_register_wins_send(struct nbt_name_s
|
||||
|
||||
state->wins_port = io->in.wins_port;
|
||||
state->wins_servers = str_list_copy(state, io->in.wins_servers);
|
||||
if (state->wins_servers == NULL ||
|
||||
if (state->wins_servers == NULL ||
|
||||
state->wins_servers[0] == NULL) goto failed;
|
||||
|
||||
state->addresses = str_list_copy(state, io->in.addresses);
|
||||
if (state->addresses == NULL ||
|
||||
if (state->addresses == NULL ||
|
||||
state->addresses[0] == NULL) goto failed;
|
||||
|
||||
state->io->in.name = io->in.name;
|
||||
@ -399,7 +399,7 @@ _PUBLIC_ struct composite_context *nbt_name_register_wins_send(struct nbt_name_s
|
||||
if (state->req == NULL) goto failed;
|
||||
|
||||
state->req->async.fn = name_register_wins_handler;
|
||||
state->req->async.private = c;
|
||||
state->req->async.private_data = c;
|
||||
|
||||
c->private_data = state;
|
||||
c->state = COMPOSITE_STATE_IN_PROGRESS;
|
||||
@ -421,7 +421,7 @@ _PUBLIC_ NTSTATUS nbt_name_register_wins_recv(struct composite_context *c, TALLO
|
||||
NTSTATUS status;
|
||||
status = composite_wait(c);
|
||||
if (NT_STATUS_IS_OK(status)) {
|
||||
struct register_wins_state *state =
|
||||
struct register_wins_state *state =
|
||||
talloc_get_type(c->private_data, struct register_wins_state);
|
||||
io->out.wins_server = talloc_steal(mem_ctx, state->wins_servers[0]);
|
||||
io->out.rcode = state->io->out.rcode;
|
@ -1,27 +1,27 @@
|
||||
/*
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
send out a name release request
|
||||
|
||||
Copyright (C) Andrew Tridgell 2005
|
||||
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include "libcli/nbt/libnbt.h"
|
||||
#include "libcli/nbt/nbt_proto.h"
|
||||
#include "../libcli/nbt/libnbt.h"
|
||||
#include "../libcli/nbt/nbt_proto.h"
|
||||
#include "lib/socket/socket.h"
|
||||
#include "param/param.h"
|
||||
|
||||
@ -64,10 +64,10 @@ _PUBLIC_ struct nbt_name_request *nbt_name_release_send(struct nbt_name_socket *
|
||||
struct nbt_rdata_address, 1);
|
||||
if (packet->additional[0].rdata.netbios.addresses == NULL) goto failed;
|
||||
packet->additional[0].rdata.netbios.addresses[0].nb_flags = io->in.nb_flags;
|
||||
packet->additional[0].rdata.netbios.addresses[0].ipaddr =
|
||||
packet->additional[0].rdata.netbios.addresses[0].ipaddr =
|
||||
talloc_strdup(packet->additional, io->in.address);
|
||||
|
||||
dest = socket_address_from_strings(packet, nbtsock->sock->backend_name,
|
||||
dest = socket_address_from_strings(packet, nbtsock->sock->backend_name,
|
||||
io->in.dest_addr, io->in.dest_port);
|
||||
if (dest == NULL) goto failed;
|
||||
req = nbt_name_request_send(nbtsock, dest, packet,
|
||||
@ -79,13 +79,13 @@ _PUBLIC_ struct nbt_name_request *nbt_name_release_send(struct nbt_name_socket *
|
||||
|
||||
failed:
|
||||
talloc_free(packet);
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
wait for a release reply
|
||||
*/
|
||||
_PUBLIC_ NTSTATUS nbt_name_release_recv(struct nbt_name_request *req,
|
||||
_PUBLIC_ NTSTATUS nbt_name_release_recv(struct nbt_name_request *req,
|
||||
TALLOC_CTX *mem_ctx, struct nbt_name_release *io)
|
||||
{
|
||||
NTSTATUS status;
|
||||
@ -97,7 +97,7 @@ _PUBLIC_ NTSTATUS nbt_name_release_recv(struct nbt_name_request *req,
|
||||
talloc_free(req);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
packet = req->replies[0].packet;
|
||||
io->out.reply_from = talloc_steal(mem_ctx, req->replies[0].dest->addr);
|
||||
|
||||
@ -114,7 +114,7 @@ _PUBLIC_ NTSTATUS nbt_name_release_recv(struct nbt_name_request *req,
|
||||
talloc_free(req);
|
||||
return NT_STATUS_INVALID_NETWORK_RESPONSE;
|
||||
}
|
||||
io->out.reply_addr = talloc_steal(mem_ctx,
|
||||
io->out.reply_addr = talloc_steal(mem_ctx,
|
||||
packet->answers[0].rdata.netbios.addresses[0].ipaddr);
|
||||
talloc_steal(mem_ctx, io->out.name.name);
|
||||
talloc_steal(mem_ctx, io->out.name.scope);
|
||||
@ -127,7 +127,7 @@ _PUBLIC_ NTSTATUS nbt_name_release_recv(struct nbt_name_request *req,
|
||||
/*
|
||||
synchronous name release request
|
||||
*/
|
||||
_PUBLIC_ NTSTATUS nbt_name_release(struct nbt_name_socket *nbtsock,
|
||||
_PUBLIC_ NTSTATUS nbt_name_release(struct nbt_name_socket *nbtsock,
|
||||
TALLOC_CTX *mem_ctx, struct nbt_name_release *io)
|
||||
{
|
||||
struct nbt_name_request *req = nbt_name_release_send(nbtsock, io);
|
43
libcli/nbt/nbt_proto.h
Normal file
43
libcli/nbt/nbt_proto.h
Normal file
@ -0,0 +1,43 @@
|
||||
#ifndef _____LIBCLI_NBT_NBT_PROTO_H__
|
||||
#define _____LIBCLI_NBT_NBT_PROTO_H__
|
||||
|
||||
#undef _PRINTF_ATTRIBUTE
|
||||
#define _PRINTF_ATTRIBUTE(a1, a2) PRINTF_ATTRIBUTE(a1, a2)
|
||||
/* This file was automatically generated by mkproto.pl. DO NOT EDIT */
|
||||
|
||||
/* this file contains prototypes for functions that are private
|
||||
* to this subsystem or library. These functions should not be
|
||||
* used outside this particular subsystem! */
|
||||
|
||||
|
||||
/* The following definitions come from ../libcli/nbt/nbtsocket.c */
|
||||
|
||||
struct nbt_name_request *nbt_name_request_send(struct nbt_name_socket *nbtsock,
|
||||
struct socket_address *dest,
|
||||
struct nbt_name_packet *request,
|
||||
int timeout, int retries,
|
||||
bool allow_multiple_replies);
|
||||
NTSTATUS nbt_name_request_recv(struct nbt_name_request *req);
|
||||
|
||||
/* The following definitions come from ../libcli/nbt/namequery.c */
|
||||
|
||||
|
||||
/* The following definitions come from ../libcli/nbt/nameregister.c */
|
||||
|
||||
struct nbt_name_request *nbt_name_register_send(struct nbt_name_socket *nbtsock,
|
||||
struct nbt_name_register *io);
|
||||
NTSTATUS nbt_name_register_bcast(struct nbt_name_socket *nbtsock,
|
||||
struct nbt_name_register_bcast *io);
|
||||
|
||||
/* The following definitions come from ../libcli/nbt/namerefresh.c */
|
||||
|
||||
struct nbt_name_request *nbt_name_refresh_send(struct nbt_name_socket *nbtsock,
|
||||
struct nbt_name_refresh *io);
|
||||
|
||||
/* The following definitions come from ../libcli/nbt/namerelease.c */
|
||||
|
||||
#undef _PRINTF_ATTRIBUTE
|
||||
#define _PRINTF_ATTRIBUTE(a1, a2)
|
||||
|
||||
#endif /* _____LIBCLI_NBT_NBT_PROTO_H__ */
|
||||
|
@ -1,20 +1,20 @@
|
||||
/*
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
manipulate nbt name structures
|
||||
|
||||
Copyright (C) Andrew Tridgell 2005
|
||||
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -27,7 +27,6 @@
|
||||
#include "librpc/gen_ndr/ndr_nbt.h"
|
||||
#include "librpc/gen_ndr/ndr_misc.h"
|
||||
#include "system/locale.h"
|
||||
#include "param/param.h"
|
||||
|
||||
/* don't allow an unlimited number of name components */
|
||||
#define MAX_COMPONENTS 10
|
||||
@ -112,7 +111,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_nbt_string(struct ndr_pull *ndr, int ndr_fla
|
||||
|
||||
/* break up name into a list of components */
|
||||
for (num_components=0;num_components<MAX_COMPONENTS;num_components++) {
|
||||
uint8_t *component;
|
||||
uint8_t *component = NULL;
|
||||
NDR_CHECK(ndr_pull_component(ndr, &component, &offset, &max_offset));
|
||||
if (component == NULL) break;
|
||||
if (name) {
|
||||
@ -158,7 +157,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_nbt_string(struct ndr_push *ndr, int ndr_fla
|
||||
ndr_err = ndr_token_retrieve_cmp_fn(&ndr->nbt_string_list, s, &offset, (comparison_fn_t)strcmp, false);
|
||||
if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
|
||||
uint8_t b[2];
|
||||
|
||||
|
||||
if (offset > 0x3FFF) {
|
||||
return ndr_push_error(ndr, NDR_ERR_STRING,
|
||||
"offset for nbt string label pointer %u[%08X] > 0x00003FFF",
|
||||
@ -219,7 +218,7 @@ static bool decompress_name(char *name, enum nbt_name_type *type)
|
||||
c2 < 'A' || c2 > 'P') {
|
||||
return false;
|
||||
}
|
||||
name[i] = ((c1-'A')<<4) | (c2-'A');
|
||||
name[i] = ((c1-'A')<<4) | (c2-'A');
|
||||
}
|
||||
name[i] = 0;
|
||||
if (i == 16) {
|
||||
@ -234,7 +233,7 @@ static bool decompress_name(char *name, enum nbt_name_type *type)
|
||||
for (;i>0 && name[i-1]==' ';i--) {
|
||||
name[i-1] = 0;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -242,7 +241,7 @@ static bool decompress_name(char *name, enum nbt_name_type *type)
|
||||
/*
|
||||
compress a name component
|
||||
*/
|
||||
static uint8_t *compress_name(TALLOC_CTX *mem_ctx,
|
||||
static uint8_t *compress_name(TALLOC_CTX *mem_ctx,
|
||||
const uint8_t *name, enum nbt_name_type type)
|
||||
{
|
||||
uint8_t *cname;
|
||||
@ -356,7 +355,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_nbt_name(struct ndr_push *ndr, int ndr_flags
|
||||
} else {
|
||||
fullname = cname;
|
||||
}
|
||||
|
||||
|
||||
ndr_err = ndr_push_nbt_string(ndr, ndr_flags, (const char *)fullname);
|
||||
|
||||
return ndr_err;
|
||||
@ -422,7 +421,7 @@ _PUBLIC_ void nbt_choose_called_name(TALLOC_CTX *mem_ctx,
|
||||
n->scope = NULL;
|
||||
n->type = type;
|
||||
|
||||
if (is_ipaddress(name) || name == NULL) {
|
||||
if ((name == NULL) || is_ipaddress(name)) {
|
||||
n->name = "*SMBSERVER";
|
||||
return;
|
||||
}
|
||||
@ -434,11 +433,11 @@ _PUBLIC_ void nbt_choose_called_name(TALLOC_CTX *mem_ctx,
|
||||
return;
|
||||
}
|
||||
s = talloc_strndup(mem_ctx, name, PTR_DIFF(p, name));
|
||||
n->name = strupper_talloc(mem_ctx, s);
|
||||
n->name = talloc_strdup_upper(mem_ctx, s);
|
||||
return;
|
||||
}
|
||||
|
||||
n->name = strupper_talloc(mem_ctx, name);
|
||||
n->name = talloc_strdup_upper(mem_ctx, name);
|
||||
}
|
||||
|
||||
|
||||
@ -483,14 +482,14 @@ _PUBLIC_ char *nbt_name_string(TALLOC_CTX *mem_ctx, const struct nbt_name *name)
|
||||
{
|
||||
TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
|
||||
char *ret;
|
||||
if (name->scope) {
|
||||
if (name->scope) {
|
||||
ret = talloc_asprintf(mem_ctx, "%s<%02x>-%s",
|
||||
nbt_hex_encode(tmp_ctx, name->name),
|
||||
name->type,
|
||||
name->type,
|
||||
nbt_hex_encode(tmp_ctx, name->scope));
|
||||
} else {
|
||||
ret = talloc_asprintf(mem_ctx, "%s<%02x>",
|
||||
nbt_hex_encode(tmp_ctx, name->name),
|
||||
ret = talloc_asprintf(mem_ctx, "%s<%02x>",
|
||||
nbt_hex_encode(tmp_ctx, name->name),
|
||||
name->type);
|
||||
}
|
||||
talloc_free(tmp_ctx);
|
||||
@ -518,7 +517,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_wrepl_nbt_name(struct ndr_pull *ndr, int ndr
|
||||
NDR_PULL_ALLOC_N(ndr, namebuf, namebuf_len);
|
||||
NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, namebuf, namebuf_len));
|
||||
|
||||
NDR_PULL_ALLOC(ndr, r);
|
||||
NDR_PULL_ALLOC(ndr, r);
|
||||
|
||||
/* oh wow, what a nasty bug in windows ... */
|
||||
if (namebuf[0] == 0x1b && namebuf_len >= 16) {
|
||||
@ -565,7 +564,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_wrepl_nbt_name(struct ndr_push *ndr, int ndr
|
||||
{
|
||||
uint8_t *namebuf;
|
||||
uint32_t namebuf_len;
|
||||
uint32_t name_len;
|
||||
uint32_t _name_len;
|
||||
uint32_t scope_len = 0;
|
||||
|
||||
if (r == NULL) {
|
||||
@ -577,8 +576,8 @@ _PUBLIC_ enum ndr_err_code ndr_push_wrepl_nbt_name(struct ndr_push *ndr, int ndr
|
||||
return NDR_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
name_len = strlen(r->name);
|
||||
if (name_len > 15) {
|
||||
_name_len = strlen(r->name);
|
||||
if (_name_len > 15) {
|
||||
return ndr_push_error(ndr, NDR_ERR_STRING,
|
||||
"wrepl_nbt_name longer as 15 chars: %s",
|
||||
r->name);
|
@ -1,20 +1,20 @@
|
||||
/*
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
low level socket handling for nbt requests
|
||||
|
||||
Copyright (C) Andrew Tridgell 2005
|
||||
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -22,7 +22,7 @@
|
||||
#include "includes.h"
|
||||
#include "lib/events/events.h"
|
||||
#include "lib/util/dlinklist.h"
|
||||
#include "libcli/nbt/libnbt.h"
|
||||
#include "../libcli/nbt/libnbt.h"
|
||||
#include "lib/socket/socket.h"
|
||||
#include "librpc/gen_ndr/ndr_nbt.h"
|
||||
#include "param/param.h"
|
||||
@ -33,7 +33,7 @@
|
||||
destroy a pending request
|
||||
*/
|
||||
static int nbt_name_request_destructor(struct nbt_name_request *req)
|
||||
{
|
||||
{
|
||||
if (req->state == NBT_REQUEST_SEND) {
|
||||
DLIST_REMOVE(req->nbtsock->send_queue, req);
|
||||
}
|
||||
@ -51,7 +51,7 @@ static int nbt_name_request_destructor(struct nbt_name_request *req)
|
||||
if (req->nbtsock->send_queue == NULL) {
|
||||
EVENT_FD_NOT_WRITEABLE(req->nbtsock->fde);
|
||||
}
|
||||
if (req->nbtsock->num_pending == 0 &&
|
||||
if (req->nbtsock->num_pending == 0 &&
|
||||
req->nbtsock->incoming.handler == NULL) {
|
||||
EVENT_FD_NOT_READABLE(req->nbtsock->fde);
|
||||
}
|
||||
@ -70,11 +70,11 @@ static void nbt_name_socket_send(struct nbt_name_socket *nbtsock)
|
||||
|
||||
while ((req = nbtsock->send_queue)) {
|
||||
size_t len;
|
||||
|
||||
|
||||
len = req->encoded.length;
|
||||
status = socket_sendto(nbtsock->sock, &req->encoded, &len,
|
||||
status = socket_sendto(nbtsock->sock, &req->encoded, &len,
|
||||
req->dest);
|
||||
if (NT_STATUS_IS_ERR(status)) goto failed;
|
||||
if (NT_STATUS_IS_ERR(status)) goto failed;
|
||||
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
talloc_free(tmp_ctx);
|
||||
@ -116,17 +116,17 @@ failed:
|
||||
static void nbt_name_socket_timeout(struct event_context *ev, struct timed_event *te,
|
||||
struct timeval t, void *private)
|
||||
{
|
||||
struct nbt_name_request *req = talloc_get_type(private,
|
||||
struct nbt_name_request *req = talloc_get_type(private,
|
||||
struct nbt_name_request);
|
||||
|
||||
if (req->num_retries != 0) {
|
||||
req->num_retries--;
|
||||
req->te = event_add_timed(req->nbtsock->event_ctx, req,
|
||||
req->te = event_add_timed(req->nbtsock->event_ctx, req,
|
||||
timeval_add(&t, req->timeout, 0),
|
||||
nbt_name_socket_timeout, req);
|
||||
if (req->state != NBT_REQUEST_SEND) {
|
||||
req->state = NBT_REQUEST_SEND;
|
||||
DLIST_ADD_END(req->nbtsock->send_queue, req,
|
||||
DLIST_ADD_END(req->nbtsock->send_queue, req,
|
||||
struct nbt_name_request *);
|
||||
}
|
||||
EVENT_FD_WRITEABLE(req->nbtsock->fde);
|
||||
@ -201,7 +201,7 @@ static void nbt_name_socket_recv(struct nbt_name_socket *nbtsock)
|
||||
}
|
||||
|
||||
if (DEBUGLVL(10)) {
|
||||
DEBUG(10,("Received nbt packet of length %d from %s:%d\n",
|
||||
DEBUG(10,("Received nbt packet of length %d from %s:%d\n",
|
||||
(int)blob.length, src->addr, src->port));
|
||||
NDR_PRINT_DEBUG(nbt_name_packet, packet);
|
||||
}
|
||||
@ -217,7 +217,7 @@ static void nbt_name_socket_recv(struct nbt_name_socket *nbtsock)
|
||||
}
|
||||
|
||||
/* find the matching request */
|
||||
req = (struct nbt_name_request *)idr_find(nbtsock->idr,
|
||||
req = (struct nbt_name_request *)idr_find(nbtsock->idr,
|
||||
packet->name_trn_id);
|
||||
if (req == NULL) {
|
||||
if (nbtsock->unexpected.handler) {
|
||||
@ -245,15 +245,15 @@ static void nbt_name_socket_recv(struct nbt_name_socket *nbtsock)
|
||||
req->num_retries = 0;
|
||||
req->received_wack = true;
|
||||
/* although there can be a timeout in the packet, w2k3 screws it up,
|
||||
so better to set it ourselves */
|
||||
so better to set it ourselves */
|
||||
req->timeout = lp_parm_int(global_loadparm, NULL, "nbt", "wack_timeout", 30);
|
||||
req->te = event_add_timed(req->nbtsock->event_ctx, req,
|
||||
req->te = event_add_timed(req->nbtsock->event_ctx, req,
|
||||
timeval_current_ofs(req->timeout, 0),
|
||||
nbt_name_socket_timeout, req);
|
||||
talloc_free(tmp_ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
req->replies = talloc_realloc(req, req->replies, struct nbt_name_reply, req->num_replies+1);
|
||||
if (req->replies == NULL) {
|
||||
@ -293,11 +293,11 @@ done:
|
||||
static void nbt_name_socket_handler(struct event_context *ev, struct fd_event *fde,
|
||||
uint16_t flags, void *private)
|
||||
{
|
||||
struct nbt_name_socket *nbtsock = talloc_get_type(private,
|
||||
struct nbt_name_socket *nbtsock = talloc_get_type(private,
|
||||
struct nbt_name_socket);
|
||||
if (flags & EVENT_FD_WRITE) {
|
||||
nbt_name_socket_send(nbtsock);
|
||||
}
|
||||
}
|
||||
if (flags & EVENT_FD_READ) {
|
||||
nbt_name_socket_recv(nbtsock);
|
||||
}
|
||||
@ -308,7 +308,7 @@ static void nbt_name_socket_handler(struct event_context *ev, struct fd_event *f
|
||||
initialise a nbt_name_socket. The event_ctx is optional, if provided
|
||||
then operations will use that event context
|
||||
*/
|
||||
_PUBLIC_ struct nbt_name_socket *nbt_name_socket_init(TALLOC_CTX *mem_ctx,
|
||||
_PUBLIC_ struct nbt_name_socket *nbt_name_socket_init(TALLOC_CTX *mem_ctx,
|
||||
struct event_context *event_ctx,
|
||||
struct smb_iconv_convenience *iconv_convenience)
|
||||
{
|
||||
@ -337,10 +337,10 @@ _PUBLIC_ struct nbt_name_socket *nbt_name_socket_init(TALLOC_CTX *mem_ctx,
|
||||
nbtsock->unexpected.handler = NULL;
|
||||
nbtsock->iconv_convenience = iconv_convenience;
|
||||
|
||||
nbtsock->fde = event_add_fd(nbtsock->event_ctx, nbtsock,
|
||||
nbtsock->fde = event_add_fd(nbtsock->event_ctx, nbtsock,
|
||||
socket_get_fd(nbtsock->sock), 0,
|
||||
nbt_name_socket_handler, nbtsock);
|
||||
|
||||
|
||||
return nbtsock;
|
||||
|
||||
failed:
|
||||
@ -351,7 +351,7 @@ failed:
|
||||
/*
|
||||
send off a nbt name request
|
||||
*/
|
||||
struct nbt_name_request *nbt_name_request_send(struct nbt_name_socket *nbtsock,
|
||||
struct nbt_name_request *nbt_name_request_send(struct nbt_name_socket *nbtsock,
|
||||
struct socket_address *dest,
|
||||
struct nbt_name_packet *request,
|
||||
int timeout, int retries,
|
||||
@ -378,7 +378,7 @@ struct nbt_name_request *nbt_name_request_send(struct nbt_name_socket *nbtsock,
|
||||
id = idr_get_new_random(req->nbtsock->idr, req, UINT16_MAX);
|
||||
} else {
|
||||
if (idr_find(req->nbtsock->idr, request->name_trn_id)) goto failed;
|
||||
id = idr_get_new_above(req->nbtsock->idr, req, request->name_trn_id,
|
||||
id = idr_get_new_above(req->nbtsock->idr, req, request->name_trn_id,
|
||||
UINT16_MAX);
|
||||
}
|
||||
if (id == -1) goto failed;
|
||||
@ -386,13 +386,13 @@ struct nbt_name_request *nbt_name_request_send(struct nbt_name_socket *nbtsock,
|
||||
request->name_trn_id = id;
|
||||
req->name_trn_id = id;
|
||||
|
||||
req->te = event_add_timed(nbtsock->event_ctx, req,
|
||||
req->te = event_add_timed(nbtsock->event_ctx, req,
|
||||
timeval_current_ofs(req->timeout, 0),
|
||||
nbt_name_socket_timeout, req);
|
||||
|
||||
talloc_set_destructor(req, nbt_name_request_destructor);
|
||||
|
||||
ndr_err = ndr_push_struct_blob(&req->encoded, req,
|
||||
talloc_set_destructor(req, nbt_name_request_destructor);
|
||||
|
||||
ndr_err = ndr_push_struct_blob(&req->encoded, req,
|
||||
req->nbtsock->iconv_convenience,
|
||||
request,
|
||||
(ndr_push_flags_fn_t)ndr_push_nbt_name_packet);
|
||||
@ -401,7 +401,7 @@ struct nbt_name_request *nbt_name_request_send(struct nbt_name_socket *nbtsock,
|
||||
DLIST_ADD_END(nbtsock->send_queue, req, struct nbt_name_request *);
|
||||
|
||||
if (DEBUGLVL(10)) {
|
||||
DEBUG(10,("Queueing nbt packet to %s:%d\n",
|
||||
DEBUG(10,("Queueing nbt packet to %s:%d\n",
|
||||
req->dest->addr, req->dest->port));
|
||||
NDR_PRINT_DEBUG(nbt_name_packet, request);
|
||||
}
|
||||
@ -419,7 +419,7 @@ failed:
|
||||
/*
|
||||
send off a nbt name reply
|
||||
*/
|
||||
_PUBLIC_ NTSTATUS nbt_name_reply_send(struct nbt_name_socket *nbtsock,
|
||||
_PUBLIC_ NTSTATUS nbt_name_reply_send(struct nbt_name_socket *nbtsock,
|
||||
struct socket_address *dest,
|
||||
struct nbt_name_packet *request)
|
||||
{
|
||||
@ -435,13 +435,13 @@ _PUBLIC_ NTSTATUS nbt_name_reply_send(struct nbt_name_socket *nbtsock,
|
||||
req->state = NBT_REQUEST_SEND;
|
||||
req->is_reply = true;
|
||||
|
||||
talloc_set_destructor(req, nbt_name_request_destructor);
|
||||
talloc_set_destructor(req, nbt_name_request_destructor);
|
||||
|
||||
if (DEBUGLVL(10)) {
|
||||
NDR_PRINT_DEBUG(nbt_name_packet, request);
|
||||
NDR_PRINT_DEBUG(nbt_name_packet, request);
|
||||
}
|
||||
|
||||
ndr_err = ndr_push_struct_blob(&req->encoded, req,
|
||||
ndr_err = ndr_push_struct_blob(&req->encoded, req,
|
||||
req->nbtsock->iconv_convenience,
|
||||
request,
|
||||
(ndr_push_flags_fn_t)ndr_push_nbt_name_packet);
|
||||
@ -483,12 +483,12 @@ NTSTATUS nbt_name_request_recv(struct nbt_name_request *req)
|
||||
setup a handler for incoming requests
|
||||
*/
|
||||
_PUBLIC_ NTSTATUS nbt_set_incoming_handler(struct nbt_name_socket *nbtsock,
|
||||
void (*handler)(struct nbt_name_socket *, struct nbt_name_packet *,
|
||||
void (*handler)(struct nbt_name_socket *, struct nbt_name_packet *,
|
||||
struct socket_address *),
|
||||
void *private)
|
||||
{
|
||||
nbtsock->incoming.handler = handler;
|
||||
nbtsock->incoming.private = private;
|
||||
nbtsock->incoming.private_data = private;
|
||||
EVENT_FD_READABLE(nbtsock->fde);
|
||||
return NT_STATUS_OK;
|
||||
}
|
@ -1,18 +1,18 @@
|
||||
/*
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
Samba utility functions
|
||||
Copyright © Jelmer Vernooij <jelmer@samba.org> 2008
|
||||
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -20,7 +20,7 @@
|
||||
#include "includes.h"
|
||||
#include <Python.h>
|
||||
#include "libcli/util/pyerrors.h"
|
||||
#include "libcli/nbt/libnbt.h"
|
||||
#include "../libcli/nbt/libnbt.h"
|
||||
#include "lib/events/events.h"
|
||||
#include "param/param.h"
|
||||
|
||||
@ -48,7 +48,7 @@ static PyObject *py_nbt_node_init(PyTypeObject *self, PyObject *args, PyObject *
|
||||
return NULL;
|
||||
|
||||
ev = s4_event_context_init(ret->mem_ctx);
|
||||
ret->socket = nbt_name_socket_init(ret->mem_ctx, ev, lp_iconv_convenience(global_loadparm));
|
||||
ret->socket = nbt_name_socket_init(ret->mem_ctx, ev, lp_iconv_convenience(global_loadparm));
|
||||
return (PyObject *)ret;
|
||||
}
|
||||
|
||||
@ -58,14 +58,14 @@ static bool PyObject_AsDestinationTuple(PyObject *obj, const char **dest_addr, u
|
||||
*dest_addr = PyString_AsString(obj);
|
||||
*dest_port = NBT_NAME_SERVICE_PORT;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (PyTuple_Check(obj)) {
|
||||
if (PyTuple_Size(obj) < 1) {
|
||||
PyErr_SetString(PyExc_TypeError, "Destination tuple size invalid");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!PyString_Check(PyTuple_GetItem(obj, 0))) {
|
||||
PyErr_SetString(PyExc_TypeError, "Destination tuple first element not string");
|
||||
return false;
|
||||
@ -120,7 +120,7 @@ static bool PyObject_AsNBTName(PyObject *obj, struct nbt_name_socket *socket, st
|
||||
return false;
|
||||
}
|
||||
|
||||
static PyObject *PyObject_FromNBTName(struct nbt_name_socket *socket, struct smb_iconv_convenience *ic,
|
||||
static PyObject *PyObject_FromNBTName(struct nbt_name_socket *socket, struct smb_iconv_convenience *ic,
|
||||
struct nbt_name *name)
|
||||
{
|
||||
if (name->scope) {
|
||||
@ -145,10 +145,10 @@ static PyObject *py_nbt_name_query(PyObject *self, PyObject *args, PyObject *kwa
|
||||
io.in.timeout = 0;
|
||||
io.in.retries = 3;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|bbii:query_name",
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|bbii:query_name",
|
||||
discard_const_p(char *, kwnames),
|
||||
&py_name, &py_dest,
|
||||
&io.in.broadcast, &io.in.wins_lookup,
|
||||
&py_name, &py_dest,
|
||||
&io.in.broadcast, &io.in.wins_lookup,
|
||||
&io.in.timeout, &io.in.retries)) {
|
||||
return NULL;
|
||||
}
|
||||
@ -182,7 +182,7 @@ static PyObject *py_nbt_name_query(PyObject *self, PyObject *args, PyObject *kwa
|
||||
Py_DECREF(ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < io.out.num_addrs; i++) {
|
||||
PyList_SetItem(reply_addrs, i, PyString_FromString(io.out.reply_addrs[i]));
|
||||
}
|
||||
@ -204,9 +204,9 @@ static PyObject *py_nbt_name_status(PyObject *self, PyObject *args, PyObject *kw
|
||||
io.in.timeout = 0;
|
||||
io.in.retries = 0;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|ii:name_status",
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|ii:name_status",
|
||||
discard_const_p(char *, kwnames),
|
||||
&py_name, &py_dest,
|
||||
&py_name, &py_dest,
|
||||
&io.in.timeout, &io.in.retries)) {
|
||||
return NULL;
|
||||
}
|
||||
@ -238,9 +238,9 @@ static PyObject *py_nbt_name_status(PyObject *self, PyObject *args, PyObject *kw
|
||||
py_names = PyList_New(io.out.status.num_names);
|
||||
|
||||
for (i = 0; i < io.out.status.num_names; i++) {
|
||||
PyList_SetItem(py_names, i, Py_BuildValue("(sii)",
|
||||
PyList_SetItem(py_names, i, Py_BuildValue("(sii)",
|
||||
io.out.status.names[i].name,
|
||||
io.out.status.names[i].nb_flags,
|
||||
io.out.status.names[i].nb_flags,
|
||||
io.out.status.names[i].type));
|
||||
}
|
||||
|
||||
@ -256,7 +256,7 @@ static PyObject *py_nbt_name_register(PyObject *self, PyObject *args, PyObject *
|
||||
struct nbt_name_register io;
|
||||
NTSTATUS status;
|
||||
|
||||
const char *kwnames[] = { "name", "address", "dest", "register_demand", "broadcast",
|
||||
const char *kwnames[] = { "name", "address", "dest", "register_demand", "broadcast",
|
||||
"multi_homed", "ttl", "timeout", "retries", NULL };
|
||||
|
||||
io.in.broadcast = true;
|
||||
@ -265,11 +265,11 @@ static PyObject *py_nbt_name_register(PyObject *self, PyObject *args, PyObject *
|
||||
io.in.timeout = 0;
|
||||
io.in.retries = 0;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OsO|bbbiii:query_name",
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OsO|bbbiii:query_name",
|
||||
discard_const_p(char *, kwnames),
|
||||
&py_name, &io.in.address, &py_dest,
|
||||
&io.in.register_demand,
|
||||
&io.in.broadcast, &io.in.multi_homed,
|
||||
&py_name, &io.in.address, &py_dest,
|
||||
&io.in.register_demand,
|
||||
&io.in.broadcast, &io.in.multi_homed,
|
||||
&io.in.ttl, &io.in.timeout, &io.in.retries)) {
|
||||
return NULL;
|
||||
}
|
||||
@ -312,7 +312,7 @@ static PyObject *py_nbt_name_refresh(PyObject *self, PyObject *args, PyObject *k
|
||||
struct nbt_name_refresh io;
|
||||
NTSTATUS status;
|
||||
|
||||
const char *kwnames[] = { "name", "address", "dest", "nb_flags", "broadcast",
|
||||
const char *kwnames[] = { "name", "address", "dest", "nb_flags", "broadcast",
|
||||
"ttl", "timeout", "retries", NULL };
|
||||
|
||||
io.in.broadcast = true;
|
||||
@ -320,11 +320,11 @@ static PyObject *py_nbt_name_refresh(PyObject *self, PyObject *args, PyObject *k
|
||||
io.in.timeout = 0;
|
||||
io.in.retries = 0;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OsO|ibiii:query_name",
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OsO|ibiii:query_name",
|
||||
discard_const_p(char *, kwnames),
|
||||
&py_name, &io.in.address, &py_dest,
|
||||
&io.in.nb_flags,
|
||||
&io.in.broadcast,
|
||||
&py_name, &io.in.address, &py_dest,
|
||||
&io.in.nb_flags,
|
||||
&io.in.broadcast,
|
||||
&io.in.ttl, &io.in.timeout, &io.in.retries)) {
|
||||
return NULL;
|
||||
}
|
||||
@ -366,7 +366,7 @@ static PyObject *py_nbt_name_release(PyObject *self, PyObject *args, PyObject *k
|
||||
}
|
||||
|
||||
static PyMethodDef py_nbt_methods[] = {
|
||||
{ "query_name", (PyCFunction)py_nbt_name_query, METH_VARARGS|METH_KEYWORDS,
|
||||
{ "query_name", (PyCFunction)py_nbt_name_query, METH_VARARGS|METH_KEYWORDS,
|
||||
"S.query_name(name, dest, broadcast=True, wins=False, timeout=0, retries=3) -> (reply_from, name, reply_addr)\n"
|
||||
"Query for a NetBIOS name" },
|
||||
{ "register_name", (PyCFunction)py_nbt_name_register, METH_VARARGS|METH_KEYWORDS,
|
@ -1,20 +1,20 @@
|
||||
/*
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
CLDAP server structures
|
||||
|
||||
Copyright (C) Andrew Bartlett <abartlet@samba.org> 2008
|
||||
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -22,7 +22,8 @@
|
||||
/* parser auto-generated by pidl, then hand-modified by abartlet */
|
||||
|
||||
#include "includes.h"
|
||||
#include "libcli/netlogon.h"
|
||||
#include "../libcli/netlogon.h"
|
||||
|
||||
/* Manually modified to handle the dom_sid being optional based on if it is present or all zero */
|
||||
enum ndr_err_code ndr_push_NETLOGON_SAM_LOGON_REQUEST(struct ndr_push *ndr, int ndr_flags, const struct NETLOGON_SAM_LOGON_REQUEST *r)
|
||||
{
|
24
libcli/ndr_netlogon_proto.h
Normal file
24
libcli/ndr_netlogon_proto.h
Normal file
@ -0,0 +1,24 @@
|
||||
#ifndef _____LIBCLI_NDR_NETLOGON_PROTO_H__
|
||||
#define _____LIBCLI_NDR_NETLOGON_PROTO_H__
|
||||
|
||||
#undef _PRINTF_ATTRIBUTE
|
||||
#define _PRINTF_ATTRIBUTE(a1, a2) PRINTF_ATTRIBUTE(a1, a2)
|
||||
/* This file was automatically generated by mkproto.pl. DO NOT EDIT */
|
||||
|
||||
/* this file contains prototypes for functions that are private
|
||||
* to this subsystem or library. These functions should not be
|
||||
* used outside this particular subsystem! */
|
||||
|
||||
|
||||
/* The following definitions come from ../libcli/ndr_netlogon.c */
|
||||
|
||||
enum ndr_err_code ndr_push_NETLOGON_SAM_LOGON_REQUEST(struct ndr_push *ndr, int ndr_flags, const struct NETLOGON_SAM_LOGON_REQUEST *r);
|
||||
enum ndr_err_code ndr_pull_NETLOGON_SAM_LOGON_REQUEST(struct ndr_pull *ndr, int ndr_flags, struct NETLOGON_SAM_LOGON_REQUEST *r);
|
||||
enum ndr_err_code ndr_push_NETLOGON_SAM_LOGON_RESPONSE_EX_with_flags(struct ndr_push *ndr, int ndr_flags, const struct NETLOGON_SAM_LOGON_RESPONSE_EX *r);
|
||||
enum ndr_err_code ndr_pull_NETLOGON_SAM_LOGON_RESPONSE_EX_with_flags(struct ndr_pull *ndr, int ndr_flags, struct NETLOGON_SAM_LOGON_RESPONSE_EX *r,
|
||||
uint32_t nt_version_flags);
|
||||
#undef _PRINTF_ATTRIBUTE
|
||||
#define _PRINTF_ATTRIBUTE(a1, a2)
|
||||
|
||||
#endif /* _____LIBCLI_NDR_NETLOGON_PROTO_H__ */
|
||||
|
@ -1,46 +1,53 @@
|
||||
/*
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
CLDAP server structures
|
||||
|
||||
Copyright (C) Andrew Bartlett <abartlet@samba.org> 2008
|
||||
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include "libcli/netlogon.h"
|
||||
#include "../libcli/netlogon.h"
|
||||
|
||||
NTSTATUS push_netlogon_samlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx,
|
||||
#undef DEBUG
|
||||
#define DEBUG(x, y)
|
||||
#undef DEBUGLVL
|
||||
#define DEBUGLVL(x) false
|
||||
#undef DEBUGLEVEL
|
||||
#define DEBUGLEVEL 0
|
||||
|
||||
NTSTATUS push_netlogon_samlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx,
|
||||
struct smb_iconv_convenience *iconv_convenience,
|
||||
struct netlogon_samlogon_response *response)
|
||||
struct netlogon_samlogon_response *response)
|
||||
{
|
||||
enum ndr_err_code ndr_err;
|
||||
if (response->ntver == NETLOGON_NT_VERSION_1) {
|
||||
ndr_err = ndr_push_struct_blob(data, mem_ctx,
|
||||
ndr_err = ndr_push_struct_blob(data, mem_ctx,
|
||||
iconv_convenience,
|
||||
&response->nt4,
|
||||
&response->data.nt4,
|
||||
(ndr_push_flags_fn_t)ndr_push_NETLOGON_SAM_LOGON_RESPONSE_NT40);
|
||||
} else if (response->ntver & NETLOGON_NT_VERSION_5EX) {
|
||||
ndr_err = ndr_push_struct_blob(data, mem_ctx,
|
||||
ndr_err = ndr_push_struct_blob(data, mem_ctx,
|
||||
iconv_convenience,
|
||||
&response->nt5_ex,
|
||||
&response->data.nt5_ex,
|
||||
(ndr_push_flags_fn_t)ndr_push_NETLOGON_SAM_LOGON_RESPONSE_EX_with_flags);
|
||||
} else if (response->ntver & NETLOGON_NT_VERSION_5) {
|
||||
ndr_err = ndr_push_struct_blob(data, mem_ctx,
|
||||
ndr_err = ndr_push_struct_blob(data, mem_ctx,
|
||||
iconv_convenience,
|
||||
&response->nt5,
|
||||
&response->data.nt5,
|
||||
(ndr_push_flags_fn_t)ndr_push_NETLOGON_SAM_LOGON_RESPONSE);
|
||||
} else {
|
||||
DEBUG(0, ("Asked to push unknown netlogon response type 0x%02x\n", response->ntver));
|
||||
@ -54,7 +61,7 @@ NTSTATUS push_netlogon_samlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx,
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
NTSTATUS pull_netlogon_samlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx,
|
||||
NTSTATUS pull_netlogon_samlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx,
|
||||
struct smb_iconv_convenience *iconv_convenience,
|
||||
struct netlogon_samlogon_response *response)
|
||||
{
|
||||
@ -75,33 +82,48 @@ NTSTATUS pull_netlogon_samlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx,
|
||||
}
|
||||
|
||||
ntver = IVAL(data->data, data->length - 8);
|
||||
|
||||
|
||||
if (ntver == NETLOGON_NT_VERSION_1) {
|
||||
ndr_err = ndr_pull_struct_blob_all(data, mem_ctx,
|
||||
ndr_err = ndr_pull_struct_blob_all(data, mem_ctx,
|
||||
iconv_convenience,
|
||||
&response->nt4,
|
||||
&response->data.nt4,
|
||||
(ndr_pull_flags_fn_t)ndr_pull_NETLOGON_SAM_LOGON_RESPONSE_NT40);
|
||||
response->ntver = NETLOGON_NT_VERSION_1;
|
||||
if (NDR_ERR_CODE_IS_SUCCESS(ndr_err) && DEBUGLEVEL >= 10) {
|
||||
NDR_PRINT_DEBUG(NETLOGON_SAM_LOGON_RESPONSE_NT40,
|
||||
&response->data.nt4);
|
||||
}
|
||||
|
||||
} else if (ntver & NETLOGON_NT_VERSION_5EX) {
|
||||
struct ndr_pull *ndr;
|
||||
ndr = ndr_pull_init_blob(data, mem_ctx, iconv_convenience);
|
||||
if (!ndr) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
ndr_err = ndr_pull_NETLOGON_SAM_LOGON_RESPONSE_EX_with_flags(ndr, NDR_SCALARS|NDR_BUFFERS, &response->nt5_ex, ntver);
|
||||
ndr_err = ndr_pull_NETLOGON_SAM_LOGON_RESPONSE_EX_with_flags(
|
||||
ndr, NDR_SCALARS|NDR_BUFFERS, &response->data.nt5_ex,
|
||||
ntver);
|
||||
if (ndr->offset < ndr->data_size) {
|
||||
ndr_err = ndr_pull_error(ndr, NDR_ERR_UNREAD_BYTES,
|
||||
"not all bytes consumed ofs[%u] size[%u]",
|
||||
ndr->offset, ndr->data_size);
|
||||
}
|
||||
response->ntver = NETLOGON_NT_VERSION_5EX;
|
||||
if (NDR_ERR_CODE_IS_SUCCESS(ndr_err) && DEBUGLEVEL >= 10) {
|
||||
NDR_PRINT_DEBUG(NETLOGON_SAM_LOGON_RESPONSE_EX,
|
||||
&response->data.nt5_ex);
|
||||
}
|
||||
|
||||
} else if (ntver & NETLOGON_NT_VERSION_5) {
|
||||
ndr_err = ndr_pull_struct_blob_all(data, mem_ctx,
|
||||
ndr_err = ndr_pull_struct_blob_all(data, mem_ctx,
|
||||
iconv_convenience,
|
||||
&response->nt5,
|
||||
&response->data.nt5,
|
||||
(ndr_pull_flags_fn_t)ndr_pull_NETLOGON_SAM_LOGON_RESPONSE);
|
||||
response->ntver = NETLOGON_NT_VERSION_5;
|
||||
if (NDR_ERR_CODE_IS_SUCCESS(ndr_err) && DEBUGLEVEL >= 10) {
|
||||
NDR_PRINT_DEBUG(NETLOGON_SAM_LOGON_RESPONSE,
|
||||
&response->data.nt5);
|
||||
}
|
||||
} else {
|
||||
DEBUG(2,("failed to parse netlogon response of type 0x%02x - unknown response type\n",
|
||||
ntver));
|
||||
@ -115,6 +137,7 @@ NTSTATUS pull_netlogon_samlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx,
|
||||
dump_data(10, data->data, data->length);
|
||||
return ndr_map_error2ntstatus(ndr_err);
|
||||
}
|
||||
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
@ -126,48 +149,50 @@ void map_netlogon_samlogon_response(struct netlogon_samlogon_response *response)
|
||||
break;
|
||||
case NETLOGON_NT_VERSION_5:
|
||||
ZERO_STRUCT(response_5_ex);
|
||||
response_5_ex.command = response->nt5.command;
|
||||
response_5_ex.pdc_name = response->nt5.pdc_name;
|
||||
response_5_ex.user_name = response->nt5.user_name;
|
||||
response_5_ex.domain = response->nt5.domain_name;
|
||||
response_5_ex.domain_uuid = response->nt5.domain_uuid;
|
||||
response_5_ex.forest = response->nt5.forest;
|
||||
response_5_ex.dns_domain = response->nt5.dns_domain;
|
||||
response_5_ex.pdc_dns_name = response->nt5.pdc_dns_name;
|
||||
response_5_ex.sockaddr.pdc_ip = response->nt5.pdc_ip;
|
||||
response_5_ex.server_type = response->nt5.server_type;
|
||||
response_5_ex.nt_version = response->nt5.nt_version;
|
||||
response_5_ex.lmnt_token = response->nt5.lmnt_token;
|
||||
response_5_ex.lm20_token = response->nt5.lm20_token;
|
||||
response_5_ex.command = response->data.nt5.command;
|
||||
response_5_ex.pdc_name = response->data.nt5.pdc_name;
|
||||
response_5_ex.user_name = response->data.nt5.user_name;
|
||||
response_5_ex.domain = response->data.nt5.domain_name;
|
||||
response_5_ex.domain_uuid = response->data.nt5.domain_uuid;
|
||||
response_5_ex.forest = response->data.nt5.forest;
|
||||
response_5_ex.dns_domain = response->data.nt5.dns_domain;
|
||||
response_5_ex.pdc_dns_name = response->data.nt5.pdc_dns_name;
|
||||
response_5_ex.sockaddr.pdc_ip = response->data.nt5.pdc_ip;
|
||||
response_5_ex.server_type = response->data.nt5.server_type;
|
||||
response_5_ex.nt_version = response->data.nt5.nt_version;
|
||||
response_5_ex.lmnt_token = response->data.nt5.lmnt_token;
|
||||
response_5_ex.lm20_token = response->data.nt5.lm20_token;
|
||||
response->ntver = NETLOGON_NT_VERSION_5EX;
|
||||
response->nt5_ex = response_5_ex;
|
||||
response->data.nt5_ex = response_5_ex;
|
||||
break;
|
||||
|
||||
|
||||
case NETLOGON_NT_VERSION_1:
|
||||
ZERO_STRUCT(response_5_ex);
|
||||
response_5_ex.command = response->nt4.command;
|
||||
response_5_ex.pdc_name = response->nt4.server;
|
||||
response_5_ex.user_name = response->nt4.user_name;
|
||||
response_5_ex.domain = response->nt4.domain;
|
||||
response_5_ex.nt_version = response->nt4.nt_version;
|
||||
response_5_ex.lmnt_token = response->nt4.lmnt_token;
|
||||
response_5_ex.lm20_token = response->nt4.lm20_token;
|
||||
response_5_ex.command = response->data.nt4.command;
|
||||
response_5_ex.pdc_name = response->data.nt4.server;
|
||||
response_5_ex.user_name = response->data.nt4.user_name;
|
||||
response_5_ex.domain = response->data.nt4.domain;
|
||||
response_5_ex.nt_version = response->data.nt4.nt_version;
|
||||
response_5_ex.lmnt_token = response->data.nt4.lmnt_token;
|
||||
response_5_ex.lm20_token = response->data.nt4.lm20_token;
|
||||
response->ntver = NETLOGON_NT_VERSION_5EX;
|
||||
response->nt5_ex = response_5_ex;
|
||||
response->data.nt5_ex = response_5_ex;
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
NTSTATUS push_nbt_netlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx,
|
||||
NTSTATUS push_nbt_netlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx,
|
||||
struct smb_iconv_convenience *iconv_convenience,
|
||||
struct nbt_netlogon_response *response)
|
||||
struct nbt_netlogon_response *response)
|
||||
{
|
||||
NTSTATUS status = NT_STATUS_INVALID_NETWORK_RESPONSE;
|
||||
enum ndr_err_code ndr_err;
|
||||
switch (response->response_type) {
|
||||
case NETLOGON_GET_PDC:
|
||||
ndr_err = ndr_push_struct_blob(data, mem_ctx, iconv_convenience, &response->get_pdc,
|
||||
ndr_err = ndr_push_struct_blob(data, mem_ctx,
|
||||
iconv_convenience,
|
||||
&response->data.get_pdc,
|
||||
(ndr_push_flags_fn_t)ndr_push_nbt_netlogon_response_from_pdc);
|
||||
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
|
||||
status = ndr_map_error2ntstatus(ndr_err);
|
||||
@ -181,16 +206,18 @@ NTSTATUS push_nbt_netlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx,
|
||||
status = NT_STATUS_OK;
|
||||
break;
|
||||
case NETLOGON_SAMLOGON:
|
||||
status = push_netlogon_samlogon_response(data, mem_ctx, iconv_convenience, &response->samlogon);
|
||||
status = push_netlogon_samlogon_response(
|
||||
data, mem_ctx, iconv_convenience,
|
||||
&response->data.samlogon);
|
||||
break;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS pull_nbt_netlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx,
|
||||
NTSTATUS pull_nbt_netlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx,
|
||||
struct smb_iconv_convenience *iconv_convenience,
|
||||
struct nbt_netlogon_response *response)
|
||||
struct nbt_netlogon_response *response)
|
||||
{
|
||||
NTSTATUS status = NT_STATUS_INVALID_NETWORK_RESPONSE;
|
||||
enum netlogon_command command;
|
||||
@ -203,7 +230,9 @@ NTSTATUS pull_nbt_netlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx,
|
||||
|
||||
switch (command) {
|
||||
case NETLOGON_RESPONSE_FROM_PDC:
|
||||
ndr_err = ndr_pull_struct_blob_all(data, mem_ctx, iconv_convenience, &response->get_pdc,
|
||||
ndr_err = ndr_pull_struct_blob_all(data, mem_ctx,
|
||||
iconv_convenience,
|
||||
&response->data.get_pdc,
|
||||
(ndr_pull_flags_fn_t)ndr_pull_nbt_netlogon_response_from_pdc);
|
||||
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
|
||||
status = ndr_map_error2ntstatus(ndr_err);
|
||||
@ -223,10 +252,12 @@ NTSTATUS pull_nbt_netlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx,
|
||||
case LOGON_SAM_LOGON_RESPONSE_EX:
|
||||
case LOGON_SAM_LOGON_PAUSE_RESPONSE_EX:
|
||||
case LOGON_SAM_LOGON_USER_UNKNOWN_EX:
|
||||
status = pull_netlogon_samlogon_response(data, mem_ctx, iconv_convenience, &response->samlogon);
|
||||
status = pull_netlogon_samlogon_response(
|
||||
data, mem_ctx, iconv_convenience,
|
||||
&response->data.samlogon);
|
||||
response->response_type = NETLOGON_SAMLOGON;
|
||||
break;
|
||||
|
||||
|
||||
/* These levels are queries, not responses */
|
||||
case LOGON_PRIMARY_QUERY:
|
||||
case NETLOGON_ANNOUNCE_UAS:
|
@ -1,20 +1,20 @@
|
||||
/*
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
CLDAP server structures
|
||||
|
||||
Copyright (C) Andrew Bartlett <abartlet@samba.org> 2008
|
||||
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -36,7 +36,7 @@ struct netlogon_samlogon_response
|
||||
struct NETLOGON_SAM_LOGON_RESPONSE_NT40 nt4;
|
||||
struct NETLOGON_SAM_LOGON_RESPONSE nt5;
|
||||
struct NETLOGON_SAM_LOGON_RESPONSE_EX nt5_ex;
|
||||
};
|
||||
} data;
|
||||
|
||||
};
|
||||
|
||||
@ -46,9 +46,9 @@ struct nbt_netlogon_response
|
||||
union {
|
||||
struct nbt_netlogon_response_from_pdc get_pdc;
|
||||
struct netlogon_samlogon_response samlogon;
|
||||
};
|
||||
} data;
|
||||
};
|
||||
|
||||
#include "libcli/netlogon_proto.h"
|
||||
#include "libcli/ndr_netlogon_proto.h"
|
||||
#include "../libcli/netlogon_proto.h"
|
||||
#include "../libcli/ndr_netlogon_proto.h"
|
||||
#endif /* __CLDAP_SERVER_PROTO_H__ */
|
32
libcli/netlogon_proto.h
Normal file
32
libcli/netlogon_proto.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef _____LIBCLI_NETLOGON_PROTO_H__
|
||||
#define _____LIBCLI_NETLOGON_PROTO_H__
|
||||
|
||||
#undef _PRINTF_ATTRIBUTE
|
||||
#define _PRINTF_ATTRIBUTE(a1, a2) PRINTF_ATTRIBUTE(a1, a2)
|
||||
/* This file was automatically generated by mkproto.pl. DO NOT EDIT */
|
||||
|
||||
/* this file contains prototypes for functions that are private
|
||||
* to this subsystem or library. These functions should not be
|
||||
* used outside this particular subsystem! */
|
||||
|
||||
|
||||
/* The following definitions come from ../libcli/netlogon.c */
|
||||
|
||||
NTSTATUS push_netlogon_samlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx,
|
||||
struct smb_iconv_convenience *iconv_convenience,
|
||||
struct netlogon_samlogon_response *response);
|
||||
NTSTATUS pull_netlogon_samlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx,
|
||||
struct smb_iconv_convenience *iconv_convenience,
|
||||
struct netlogon_samlogon_response *response);
|
||||
void map_netlogon_samlogon_response(struct netlogon_samlogon_response *response);
|
||||
NTSTATUS push_nbt_netlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx,
|
||||
struct smb_iconv_convenience *iconv_convenience,
|
||||
struct nbt_netlogon_response *response);
|
||||
NTSTATUS pull_nbt_netlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx,
|
||||
struct smb_iconv_convenience *iconv_convenience,
|
||||
struct nbt_netlogon_response *response);
|
||||
#undef _PRINTF_ATTRIBUTE
|
||||
#define _PRINTF_ATTRIBUTE(a1, a2)
|
||||
|
||||
#endif /* _____LIBCLI_NETLOGON_PROTO_H__ */
|
||||
|
@ -1,8 +1,5 @@
|
||||
- warn when union instances don't have a discriminant
|
||||
|
||||
- EJS output backend shouldn't use the NDR levels stuff but instead
|
||||
as the "C levels" and NDR levels don't necessarily match.
|
||||
|
||||
- true multiple dimension array / strings in arrays support
|
||||
|
||||
- compatibility mode for generating MIDL-readable data:
|
||||
|
@ -1,13 +1,13 @@
|
||||
PIDL = $(PERL) $(pidldir)/pidl
|
||||
|
||||
$(pidldir)/Makefile: $(pidldir)/Makefile.PL
|
||||
cd $(pidldir) && $(PERL) Makefile.PL PREFIX=$(prefix)
|
||||
@cd $(pidldir) && $(PERL) Makefile.PL PREFIX=$(prefix)
|
||||
|
||||
pidl-testcov: $(pidldir)/Makefile
|
||||
cd $(pidldir) && cover -test
|
||||
|
||||
installpidl:: $(pidldir)/Makefile
|
||||
$(MAKE) -C $(pidldir) install_vendor VENDORPREFIX=$(prefix) \
|
||||
@$(MAKE) -C $(pidldir) install_vendor VENDORPREFIX=$(prefix) \
|
||||
INSTALLVENDORLIB=$(datarootdir)/perl5 \
|
||||
INSTALLVENDORBIN=$(bindir) \
|
||||
INSTALLVENDORSCRIPT=$(bindir) \
|
||||
|
@ -57,6 +57,10 @@ sub ODL2IDL
|
||||
if ($x->{TYPE} eq "IMPORT") {
|
||||
foreach my $idl_file (@{$x->{PATHS}}) {
|
||||
$idl_file = unmake_str($idl_file);
|
||||
unless (-f "$basedir/$idl_file") {
|
||||
error($x, "Unable to open include file `$idl_file'");
|
||||
next;
|
||||
}
|
||||
my $podl = Parse::Pidl::IDL::parse_file("$basedir/$idl_file", $opt_incdirs);
|
||||
if (defined(@$podl)) {
|
||||
require Parse::Pidl::Typelist;
|
||||
|
@ -110,7 +110,7 @@ sub ParseFunction($$)
|
||||
pidl "\treturn false;";
|
||||
pidl "}";
|
||||
pidl "";
|
||||
pidl "pull = ndr_pull_init_blob(&blob, r);";
|
||||
pidl "pull = ndr_pull_init_blob(&blob, r, NULL);";
|
||||
pidl "if (pull == NULL) {";
|
||||
pidl "\ttalloc_free(r);";
|
||||
pidl "\treturn false;";
|
||||
|
@ -1173,6 +1173,7 @@ sub Parse($$$$$)
|
||||
$self->pidl("{");
|
||||
$self->indent;
|
||||
$self->pidl("PyObject *m;");
|
||||
$self->pidl("NTSTATUS status;");
|
||||
$self->pidl("");
|
||||
|
||||
foreach (@{$self->{ready_types}}) {
|
||||
@ -1208,6 +1209,15 @@ sub Parse($$$$$)
|
||||
$self->pidl("PyModule_AddObject(m, \"$object_name\", $c_name);");
|
||||
}
|
||||
|
||||
$self->pidl("");
|
||||
$self->pidl("status = dcerpc_init();");
|
||||
$self->pidl("if (!NT_STATUS_IS_OK(status)) {");
|
||||
$self->indent;
|
||||
$self->pidl("PyErr_SetNTSTATUS(status);");
|
||||
$self->pidl("return;");
|
||||
$self->deindent;
|
||||
$self->pidl("}");
|
||||
|
||||
$self->deindent;
|
||||
$self->pidl("}");
|
||||
return ($self->{res_hdr}, $self->{res});
|
||||
|
14
pidl/pidl
14
pidl/pidl
@ -17,7 +17,7 @@ pidl - An IDL compiler written in Perl
|
||||
|
||||
pidl --help
|
||||
|
||||
pidl [--outputdir[=OUTNAME]] [--includedir DIR...] [--parse-idl-tree] [--dump-idl-tree] [--dump-ndr-tree] [--header[=OUTPUT]] [--ejs[=OUTPUT]] [--python[=OUTPUT]] [--swig[=OUTPUT]] [--ndr-parser[=OUTPUT]] [--client] [--server] [--warn-compat] [--quiet] [--verbose] [--template] [--ws-parser[=OUTPUT]] [--diff] [--dump-idl] [--tdr-parser[=OUTPUT]] [--samba3-ndr-client[=OUTPUT]] [--samba3-ndr-server[=OUTPUT]] [--typelib=[OUTPUT]] [<idlfile>.idl]...
|
||||
pidl [--outputdir[=OUTNAME]] [--includedir DIR...] [--parse-idl-tree] [--dump-idl-tree] [--dump-ndr-tree] [--header[=OUTPUT]] [--python[=OUTPUT]] [--swig[=OUTPUT]] [--ndr-parser[=OUTPUT]] [--client] [--server] [--warn-compat] [--quiet] [--verbose] [--template] [--ws-parser[=OUTPUT]] [--diff] [--dump-idl] [--tdr-parser[=OUTPUT]] [--samba3-ndr-client[=OUTPUT]] [--samba3-ndr-server[=OUTPUT]] [--typelib=[OUTPUT]] [<idlfile>.idl]...
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
@ -478,7 +478,6 @@ my($opt_ndr_parser);
|
||||
my($opt_tdr_parser);
|
||||
my($opt_ws_parser);
|
||||
my($opt_swig);
|
||||
my($opt_ejs);
|
||||
my($opt_python);
|
||||
my($opt_quiet) = 0;
|
||||
my($opt_outputdir) = '.';
|
||||
@ -521,7 +520,6 @@ Samba 4 output:
|
||||
--ndr-parser[=OUTFILE] create a C NDR parser [ndr_BASENAME.c]
|
||||
--client[=OUTFILE] create a C NDR client [ndr_BASENAME_c.c]
|
||||
--tdr-parser[=OUTFILE] create a C TDR parser [tdr_BASENAME.c]
|
||||
--ejs[=OUTFILE] create ejs wrapper file [BASENAME_ejs.c]
|
||||
--python[=OUTFILE] create python wrapper file [py_BASENAME.c]
|
||||
--swig[=OUTFILE] create swig wrapper file [BASENAME.i]
|
||||
--server[=OUTFILE] create server boilerplate [ndr_BASENAME_s.c]
|
||||
@ -567,7 +565,6 @@ my $result = GetOptions (
|
||||
'ndr-parser:s' => \$opt_ndr_parser,
|
||||
'client:s' => \$opt_client,
|
||||
'ws-parser:s' => \$opt_ws_parser,
|
||||
'ejs' => \$opt_ejs,
|
||||
'python' => \$opt_python,
|
||||
'diff' => \$opt_diff,
|
||||
'swig:s' => \$opt_swig,
|
||||
@ -664,7 +661,6 @@ sub process_file($)
|
||||
defined($opt_server) or
|
||||
defined($opt_header) or
|
||||
defined($opt_ndr_parser) or
|
||||
defined($opt_ejs) or
|
||||
defined($opt_python) or
|
||||
defined($opt_dump_ndr_tree) or
|
||||
defined($opt_samba3_header) or
|
||||
@ -709,14 +705,6 @@ sub process_file($)
|
||||
FileSave($filename, $code);
|
||||
}
|
||||
|
||||
if (defined($opt_ejs)) {
|
||||
require Parse::Pidl::Samba4::EJS;
|
||||
my $generator = new Parse::Pidl::Samba4::EJS();
|
||||
my ($hdr,$prsr) = $generator->Parse($ndr, $h_filename);
|
||||
FileSave("$outputdir/ndr_$basename\_ejs.c", $prsr);
|
||||
FileSave("$outputdir/ndr_$basename\_ejs.h", $hdr);
|
||||
}
|
||||
|
||||
if (defined($opt_python)) {
|
||||
require Parse::Pidl::Samba4::Python;
|
||||
my $generator = new Parse::Pidl::Samba4::Python();
|
||||
|
0
pidl/tests/samba3-srv.pl
Normal file → Executable file
0
pidl/tests/samba3-srv.pl
Normal file → Executable file
@ -5,7 +5,9 @@ FROM A FEW PEOPLE. DON'T TAKE THIS AS THE FINAL VERSION YET.
|
||||
|
||||
|
||||
Samba4 Programming Guide
|
||||
------------------------
|
||||
========================
|
||||
|
||||
.. contents::
|
||||
|
||||
The internals of Samba4 are quite different from previous versions of
|
||||
Samba, so even if you are an experienced Samba developer please take
|
||||
@ -144,8 +146,7 @@ data is a bug waiting to happen.
|
||||
Static data is evil as it has the following consequences:
|
||||
- it makes code much less likely to be thread-safe
|
||||
- it makes code much less likely to be recursion-safe
|
||||
- it leads to subtle side effects when the same code is called from
|
||||
multiple places
|
||||
- it leads to subtle side effects when the same code is called from multiple places
|
||||
- doesn't play well with shared libraries or plugins
|
||||
|
||||
Static data is particularly evil in library code (such as our internal
|
||||
@ -273,9 +274,9 @@ generating the right offsets.
|
||||
The same rule applies to strings. In many places in the SMB and MSRPC
|
||||
protocols complex strings are used on the wire, with complex rules
|
||||
about padding, format, alighment, termination etc. None of that
|
||||
information is useful to a high level calling routine or to a backend
|
||||
- its all just so much wire fluff. So, in Samba4 these strings are
|
||||
just "char *" and are always in our internal multi-byte format (which
|
||||
information is useful to a high level calling routine or to a backend - its
|
||||
all just so much wire fluff. So, in Samba4 these strings are
|
||||
just "char \*" and are always in our internal multi-byte format (which
|
||||
is usually UTF8). It is up to the parse functions to worry about
|
||||
translating the format and getting the padding right.
|
||||
|
||||
@ -580,13 +581,17 @@ DCERPC Handles
|
||||
The various handles that are used in the RPC servers should be created and
|
||||
fetch using the dcesrv_handle_* functions.
|
||||
|
||||
Use dcesrv_handle_new(struct dcesrv_connection *, uint8 handle_type) to obtain
|
||||
Use dcesrv_handle_new(struct dcesrv_connection \*, uint8 handle_type) to obtain
|
||||
a new handle of the specified type. Handle types are unique within each
|
||||
pipe.
|
||||
|
||||
The handle can later be fetched again using
|
||||
struct dcesrv_handle *dcesrv_handle_fetch(struct dcesrv_connection *dce_conn, struct policy_handle *p, uint8 handle_type)
|
||||
and destroyed by dcesrv_handle_destroy(struct dcesrv_handle *).
|
||||
The handle can later be fetched again using::
|
||||
|
||||
struct dcesrv_handle *dcesrv_handle_fetch(struct dcesrv_connection *dce_conn, struct policy_handle *p, uint8 handle_type)
|
||||
|
||||
and destroyed by::
|
||||
|
||||
dcesrv_handle_destroy(struct dcesrv_handle *).
|
||||
|
||||
User data should be stored in the 'data' member of the dcesrv_handle struct.
|
||||
|
||||
@ -765,12 +770,10 @@ BUGS:
|
||||
no 137 resolution not possible
|
||||
should not fallback to anon when pass supplied
|
||||
should check pass-thu cap bit, and skip lots of tests
|
||||
possibly allow the test suite to say "allow oversized replies" for
|
||||
trans2 and other calls
|
||||
possibly allow the test suite to say "allow oversized replies" for trans2 and other calls
|
||||
handle servers that don't have the setattre call in torture
|
||||
add max file coponent length test and max path len test
|
||||
check for alloc failure in all core reply.c and trans2.c code where
|
||||
allocation size depends on client parameter
|
||||
check for alloc failure in all core reply.c and trans2.c code where allocation size depends on client parameter
|
||||
|
||||
case-insenstive idea:
|
||||
all filenames on disk lowercase
|
||||
|
@ -7,7 +7,7 @@ OPT_TAG=""
|
||||
OPT_KEYID=""
|
||||
|
||||
TOPDIR="`dirname $0`/.."
|
||||
VER_H="${TOPDIR}/source/include/version.h"
|
||||
VER_H="${TOPDIR}/source3/include/version.h"
|
||||
|
||||
function exitOnError
|
||||
{
|
||||
@ -38,7 +38,7 @@ function printUsage
|
||||
}
|
||||
|
||||
##
|
||||
## Parse the command line options
|
||||
## Parse the command line options
|
||||
##
|
||||
|
||||
function parseOptions
|
||||
@ -115,7 +115,7 @@ function buildDocs
|
||||
|
||||
rsync -av "${OPT_DOCSDIR}"/ docs/
|
||||
exitOnError $? "Failed top copy docs from ${OPT_DOCSDIR}"
|
||||
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
@ -163,23 +163,23 @@ function createReleaseTag
|
||||
##
|
||||
## Main driver
|
||||
##
|
||||
function main
|
||||
function main
|
||||
{
|
||||
parseOptions "$@"
|
||||
exitOnError $? "Failed to parse options"
|
||||
|
||||
|
||||
cd $TOPDIR
|
||||
|
||||
git-checkout ${OPT_BRANCH}
|
||||
exitOnError $? "Invalid branch name \"${OPT_BRANCH}\""
|
||||
|
||||
(cd source && ./script/mkversion.sh)
|
||||
(cd source3 && ./script/mkversion.sh)
|
||||
if [ ! -f $VER_H ]; then
|
||||
exitOnError 1 "Failed to find ${VER_H}!"
|
||||
fi
|
||||
|
||||
version=`grep SAMBA_VERSION_OFFICIAL_STRING $VER_H | awk '{print $3}'`
|
||||
vendor_version=`grep SAMBA_VERSION_VENDOR_SUFFIX $VER_H | awk '{print $3}'`
|
||||
version=`grep "define SAMBA_VERSION_OFFICIAL_STRING" $VER_H | awk '{print $3}'`
|
||||
vendor_version=`grep "define SAMBA_VERSION_VENDOR_SUFFIX" $VER_H | awk '{print $3}'`
|
||||
if [ -n "$vendor_version" ]; then
|
||||
version="$version-$vendor_version"
|
||||
fi
|
||||
@ -198,7 +198,7 @@ function main
|
||||
buildDocs
|
||||
exitOnError $? "Failed to build documentation"
|
||||
|
||||
( cd source && ./autogen.sh )
|
||||
( cd source3 && ./autogen.sh )
|
||||
|
||||
cd ..
|
||||
tar cf samba-${version}.tar --exclude=.git* --exclude=CVS --exclude=.svn samba-${version}
|
||||
|
@ -48,10 +48,7 @@ sub start_testsuite($$)
|
||||
if ($self->{immediate}) {
|
||||
print "$out\n";
|
||||
} else {
|
||||
require Term::ReadKey;
|
||||
my ($wchar, $hchar, $wpixels, $hpixels) = Term::ReadKey::GetTerminalSize();
|
||||
foreach (1..$wchar) { $out.= " "; }
|
||||
print "\r".substr($out, 0, $wchar);
|
||||
print "$out: ";
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,6 +91,13 @@ sub end_testsuite($$$$$)
|
||||
$out .= $self->{test_output}->{$name};
|
||||
}
|
||||
|
||||
if (not $self->{immediate}) {
|
||||
if (not $unexpected) {
|
||||
$out .= " ok\n";
|
||||
} else {
|
||||
$out .= " " . uc($result) . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
print $out;
|
||||
}
|
||||
@ -120,6 +124,12 @@ sub end_test($$$$$)
|
||||
|
||||
unless ($unexpected) {
|
||||
$self->{test_output}->{$self->{NAME}} = "";
|
||||
if (not $self->{immediate}) {
|
||||
if ($result eq "failure") { print "f"; }
|
||||
elsif ($result eq "skip") { print "s"; }
|
||||
elsif ($result eq "success") { print "."; }
|
||||
else { print "?($result)"; }
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -133,6 +143,13 @@ sub end_test($$$$$)
|
||||
print $self->{test_output}->{$self->{NAME}};
|
||||
$self->{test_output}->{$self->{NAME}} = "";
|
||||
}
|
||||
|
||||
if (not $self->{immediate}) {
|
||||
if ($result eq "error") { print "E"; }
|
||||
elsif ($result eq "failure") { print "F"; }
|
||||
elsif ($result eq "success") { print "S"; }
|
||||
else { print "?"; }
|
||||
}
|
||||
}
|
||||
|
||||
sub summary($)
|
||||
|
@ -303,7 +303,7 @@ Target Specific:
|
||||
--expected-failures=FILE specify list of tests that is guaranteed to fail
|
||||
|
||||
Samba4 Specific:
|
||||
--ldap=openldap|fedora-ds back smbd onto specified ldap server
|
||||
--ldap=openldap|fedora-ds back samba onto specified ldap server
|
||||
|
||||
Samba3 Specific:
|
||||
--bindir=PATH path to binaries
|
||||
@ -417,8 +417,6 @@ sub prefix_pathvar($$)
|
||||
}
|
||||
}
|
||||
prefix_pathvar("PKG_CONFIG_PATH", "$old_pwd/source4/bin/pkgconfig");
|
||||
# Required for smbscript:
|
||||
prefix_pathvar("PATH", "$old_pwd/source4/bin");
|
||||
prefix_pathvar("PYTHONPATH", "$old_pwd/source4/bin/python");
|
||||
|
||||
if ($opt_socket_wrapper_keep_pcap) {
|
||||
@ -576,7 +574,6 @@ sub write_clientconf($$)
|
||||
}
|
||||
print CF "
|
||||
private dir = $prefix_abs/client/private
|
||||
js include = $srcdir_abs/scripting/libjs
|
||||
name resolve order = bcast
|
||||
panic action = $srcdir_abs/script/gdb_backtrace \%PID\% \%PROG\%
|
||||
max xmit = 32K
|
||||
@ -812,7 +809,7 @@ if ($opt_testenv) {
|
||||
Welcome to the Samba4 Test environment '$testenv_name'
|
||||
|
||||
This matches the client environment used in make test
|
||||
smbd is pid `cat \$PIDDIR/smbd.pid`
|
||||
server is pid `cat \$PIDDIR/samba.pid`
|
||||
|
||||
Some useful environment variables:
|
||||
TORTURE_OPTIONS=\$TORTURE_OPTIONS
|
||||
|
@ -116,20 +116,20 @@ sub check_or_start($$$)
|
||||
if (defined($ENV{SMBD_OPTIONS})) {
|
||||
$optarg.= " $ENV{SMBD_OPTIONS}";
|
||||
}
|
||||
my $ret = system("$valgrind $self->{bindir}/smbd $optarg $env_vars->{CONFIGURATION} -M single -i --leak-report-full");
|
||||
my $ret = system("$valgrind $self->{bindir}/samba $optarg $env_vars->{CONFIGURATION} -M single -i --leak-report-full");
|
||||
if ($? == -1) {
|
||||
print "Unable to start smbd: $ret: $!\n";
|
||||
print "Unable to start samba: $ret: $!\n";
|
||||
exit 1;
|
||||
}
|
||||
unlink($env_vars->{SMBD_TEST_FIFO});
|
||||
my $exit = $? >> 8;
|
||||
if ( $ret == 0 ) {
|
||||
print "smbd exits with status $exit\n";
|
||||
print "samba exits with status $exit\n";
|
||||
} elsif ( $ret & 127 ) {
|
||||
print "smbd got signal ".($ret & 127)." and exits with $exit!\n";
|
||||
print "samba got signal ".($ret & 127)." and exits with $exit!\n";
|
||||
} else {
|
||||
$ret = $? >> 8;
|
||||
print "smbd failed with status $exit!\n";
|
||||
print "samba failed with status $exit!\n";
|
||||
}
|
||||
exit $exit;
|
||||
}
|
||||
@ -498,7 +498,7 @@ sub provision($$$$$$)
|
||||
{
|
||||
my ($self, $prefix, $server_role, $netbiosname, $netbiosalias, $swiface, $password) = @_;
|
||||
|
||||
my $smbd_loglevel = 1;
|
||||
my $server_loglevel = 1;
|
||||
my $username = "administrator";
|
||||
my $domain = "SAMBADOMAIN";
|
||||
my $realm = "SAMBA.EXAMPLE.COM";
|
||||
@ -555,7 +555,6 @@ sub provision($$$$$$)
|
||||
lock dir = $lockdir
|
||||
setup directory = $self->{setupdir}
|
||||
modules dir = $self->{bindir}/modules
|
||||
js include = $srcdir/scripting/libjs
|
||||
winbindd socket directory = $winbindd_socket_dir
|
||||
winbindd privileged socket directory = $winbindd_privileged_socket_dir
|
||||
ntp signd socket directory = $ntp_signd_socket_dir
|
||||
@ -572,7 +571,7 @@ sub provision($$$$$$)
|
||||
ldb:nosync = true
|
||||
#We don't want to pass our self-tests if the PAC code is wrong
|
||||
gensec:require_pac = true
|
||||
log level = $smbd_loglevel
|
||||
log level = $server_loglevel
|
||||
|
||||
[tmp]
|
||||
path = $tmpdir
|
||||
@ -607,7 +606,7 @@ sub provision($$$$$$)
|
||||
cifs:server = $netbiosname
|
||||
cifs:share = tmp
|
||||
#There is no username specified here, instead the client is expected
|
||||
#to log in with kerberos, and smbd will used delegated credentials.
|
||||
#to log in with kerberos, and the serverwill use delegated credentials.
|
||||
|
||||
[simple]
|
||||
path = $tmpdir
|
||||
@ -829,8 +828,8 @@ sub provision_dc($$)
|
||||
$self->add_wins_config("$prefix/private") or
|
||||
die("Unable to add wins configuration");
|
||||
|
||||
$ret->{SMBD_TEST_FIFO} = "$prefix/smbd_test.fifo";
|
||||
$ret->{SMBD_TEST_LOG} = "$prefix/smbd_test.log";
|
||||
$ret->{SMBD_TEST_FIFO} = "$prefix/server_test.fifo";
|
||||
$ret->{SMBD_TEST_LOG} = "$prefix/server_test.log";
|
||||
$ret->{SMBD_TEST_LOG_POS} = 0;
|
||||
return $ret;
|
||||
}
|
||||
@ -842,8 +841,8 @@ sub teardown_env($$)
|
||||
|
||||
close(DATA);
|
||||
|
||||
if (-f "$envvars->{PIDDIR}/smbd.pid" ) {
|
||||
open(IN, "<$envvars->{PIDDIR}/smbd.pid") or die("unable to open smbd pid file");
|
||||
if (-f "$envvars->{PIDDIR}/samba.pid" ) {
|
||||
open(IN, "<$envvars->{PIDDIR}/samba.pid") or die("unable to open server pid file");
|
||||
$pid = <IN>;
|
||||
close(IN);
|
||||
|
||||
@ -859,7 +858,7 @@ sub teardown_env($$)
|
||||
|
||||
# If it is still around, kill it
|
||||
if ($count > 20) {
|
||||
print "smbd process $pid took more than $count seconds to exit, killing\n";
|
||||
print "server process $pid took more than $count seconds to exit, killing\n";
|
||||
kill 9, $pid;
|
||||
}
|
||||
}
|
||||
|
@ -127,6 +127,7 @@ LOGFILEBASE = @logfilebase@
|
||||
CONFIGFILE = $(CONFIGDIR)/smb.conf
|
||||
LMHOSTSFILE = $(CONFIGDIR)/lmhosts
|
||||
CTDBDIR = @ctdbdir@
|
||||
NCALRPCDIR = @ncalrpcdir@
|
||||
|
||||
# This is where smbpasswd et al go
|
||||
PRIVATEDIR = @privatedir@
|
||||
@ -166,6 +167,7 @@ PATH_FLAGS = -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" \
|
||||
-DLOGFILEBASE=\"$(LOGFILEBASE)\" \
|
||||
-DSHLIBEXT=\"@SHLIBEXT@\" \
|
||||
-DCTDBDIR=\"$(CTDBDIR)\" \
|
||||
-DNCALRPCDIR=\"$(NCALRPCDIR)\" \
|
||||
-DCONFIGDIR=\"$(CONFIGDIR)\" \
|
||||
-DCODEPAGEDIR=\"$(CODEPAGEDIR)\" \
|
||||
-DCACHEDIR=\"$(CACHEDIR)\" \
|
||||
@ -315,12 +317,12 @@ LIB_OBJ = $(LIBSAMBAUTIL_OBJ) \
|
||||
lib/async_sock.o \
|
||||
$(TDB_LIB_OBJ) \
|
||||
$(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \
|
||||
lib/interface.o lib/md4.o \
|
||||
lib/interface.o ../lib/crypto/md4.o \
|
||||
lib/pidfile.o \
|
||||
lib/signal.o lib/system.o lib/sendfile.o lib/recvfile.o lib/time.o \
|
||||
lib/ufc.o lib/genrand.o lib/username.o \
|
||||
lib/util_pw.o lib/access.o lib/smbrun.o \
|
||||
lib/bitmap.o lib/crc32.o lib/dprintf.o \
|
||||
lib/bitmap.o ../lib/crypto/crc32.o lib/dprintf.o \
|
||||
lib/xfile.o lib/wins_srv.o $(UTIL_REG_OBJ) \
|
||||
lib/util_str.o lib/clobber.o lib/util_sid.o lib/util_uuid.o \
|
||||
lib/util_unistr.o lib/util_file.o lib/data_blob.o \
|
||||
@ -328,7 +330,7 @@ LIB_OBJ = $(LIBSAMBAUTIL_OBJ) \
|
||||
lib/substitute.o lib/fsusage.o lib/dbwrap_util.o \
|
||||
lib/ms_fnmatch.o lib/select.o lib/errmap_unix.o \
|
||||
lib/tallocmsg.o lib/dmallocmsg.o libsmb/smb_signing.o \
|
||||
lib/md5.o lib/hmacmd5.o lib/arc4.o lib/iconv.o \
|
||||
../lib/crypto/md5.o ../lib/crypto/hmacmd5.o lib/arc4.o lib/iconv.o \
|
||||
lib/pam_errors.o intl/lang_tdb.o lib/conn_tdb.o \
|
||||
lib/adt_tree.o lib/gencache.o \
|
||||
lib/module.o lib/events.o lib/ldap_escape.o @CHARSET_STATIC@ \
|
||||
@ -376,7 +378,9 @@ LIBADS_SERVER_OBJ = libads/kerberos_verify.o libads/authdata.o \
|
||||
|
||||
SECRETS_OBJ = passdb/secrets.o passdb/machine_sid.o
|
||||
|
||||
LIBNBT_OBJ = libcli/nbt/nbtname.o \
|
||||
LIBNBT_OBJ = ../libcli/nbt/nbtname.o \
|
||||
../libcli/netlogon.o \
|
||||
../libcli/ndr_netlogon.o \
|
||||
librpc/gen_ndr/ndr_nbt.o \
|
||||
librpc/gen_ndr/ndr_svcctl.o
|
||||
|
||||
@ -619,6 +623,7 @@ VFS_FILEID_OBJ = modules/vfs_fileid.o
|
||||
VFS_AIO_FORK_OBJ = modules/vfs_aio_fork.o
|
||||
VFS_SYNCOPS_OBJ = modules/vfs_syncops.o
|
||||
VFS_ACL_XATTR_OBJ = modules/vfs_acl_xattr.o
|
||||
VFS_SMB_TRAFFIC_ANALYZER_OBJ = modules/vfs_smb_traffic_analyzer.o
|
||||
|
||||
PLAINTEXT_AUTH_OBJ = auth/pampass.o auth/pass_check.o
|
||||
|
||||
@ -633,6 +638,7 @@ AUTH_SERVER_OBJ = auth/auth_server.o
|
||||
AUTH_UNIX_OBJ = auth/auth_unix.o
|
||||
AUTH_WINBIND_OBJ = auth/auth_winbind.o
|
||||
AUTH_SCRIPT_OBJ = auth/auth_script.o
|
||||
AUTH_NETLOGOND_OBJ = auth/auth_netlogond.o
|
||||
|
||||
AUTH_OBJ = auth/auth.o @AUTH_STATIC@ auth/auth_util.o auth/token_util.o \
|
||||
auth/auth_compat.o auth/auth_ntlmssp.o \
|
||||
@ -736,6 +742,10 @@ TESTPARM_OBJ = utils/testparm.o \
|
||||
$(PARAM_OBJ) $(LIB_NONSMBD_OBJ) $(POPT_LIB_OBJ) \
|
||||
$(LIBSAMBA_OBJ)
|
||||
|
||||
TEST_LP_LOAD_OBJ = param/test_lp_load.o \
|
||||
$(PARAM_OBJ) $(LIB_NONSMBD_OBJ) \
|
||||
$(POPT_LIB_OBJ) $(LIBSAMBA_OBJ)
|
||||
|
||||
PASSWD_UTIL_OBJ = utils/passwd_util.o
|
||||
|
||||
SMBPASSWD_OBJ = utils/smbpasswd.o $(PASSWD_UTIL_OBJ) $(PASSCHANGE_OBJ) \
|
||||
@ -946,13 +956,14 @@ SHARESEC_OBJ = $(SHARESEC_OBJ0) $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) \
|
||||
$(LIBSAMBA_OBJ) \
|
||||
$(POPT_LIB_OBJ)
|
||||
|
||||
TALLOCTORT_OBJ = @tallocdir@/testsuite.o $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) \
|
||||
$(LIBSAMBA_OBJ)
|
||||
TALLOCTORT_OBJ = @tallocdir@/testsuite.o @tallocdir@/testsuite_main.o \
|
||||
$(PARAM_OBJ) $(LIB_NONSMBD_OBJ) $(LIBSAMBA_OBJ)
|
||||
|
||||
REPLACETORT_OBJ = @libreplacedir@/test/testsuite.o \
|
||||
@libreplacedir@/test/getifaddrs.o \
|
||||
@libreplacedir@/test/os2_delete.o \
|
||||
@libreplacedir@/test/strptime.o \
|
||||
@libreplacedir@/test/main.o \
|
||||
$(LIBREPLACE_OBJ)
|
||||
|
||||
NDRDUMP_OBJ = librpc/tools/ndrdump.o \
|
||||
@ -984,6 +995,14 @@ IDMAP_HASH_OBJ = \
|
||||
winbindd/idmap_hash/idmap_hash.o \
|
||||
winbindd/idmap_hash/mapfile.o
|
||||
|
||||
IDMAP_ADEX_OBJ = \
|
||||
winbindd/idmap_adex/idmap_adex.o \
|
||||
winbindd/idmap_adex/cell_util.o \
|
||||
winbindd/idmap_adex/likewise_cell.o \
|
||||
winbindd/idmap_adex/provider_unified.o \
|
||||
winbindd/idmap_adex/gc_util.o \
|
||||
winbindd/idmap_adex/domain_util.o
|
||||
|
||||
WINBINDD_OBJ1 = \
|
||||
winbindd/winbindd.o \
|
||||
winbindd/winbindd_user.o \
|
||||
@ -1059,7 +1078,7 @@ LDBDEL_OBJ = $(LDB_CMDLINE_OBJ) lib/ldb/tools/ldbdel.o
|
||||
LDBMODIFY_OBJ = $(LDB_CMDLINE_OBJ) lib/ldb/tools/ldbmodify.o
|
||||
|
||||
WINBIND_KRB5_LOCATOR_OBJ1 = nsswitch/winbind_krb5_locator.o
|
||||
WINBIND_KRB5_LOCATOR_OBJ = $(WINBIND_KRB5_LOCATOR_OBJ1) $(WBCOMMON_OBJ) $(LIBREPLACE_OBJ)
|
||||
WINBIND_KRB5_LOCATOR_OBJ = $(WINBIND_KRB5_LOCATOR_OBJ1) $(LIBREPLACE_OBJ)
|
||||
|
||||
POPT_OBJ=../lib/popt/findme.o ../lib/popt/popt.o ../lib/popt/poptconfig.o \
|
||||
../lib/popt/popthelp.o ../lib/popt/poptparse.o
|
||||
@ -1127,6 +1146,8 @@ pam_smbpass: SHOWFLAGS bin/pam_smbpass.@SHLIBEXT@
|
||||
|
||||
pam_winbind: SHOWFLAGS bin/pam_winbind.@SHLIBEXT@
|
||||
|
||||
gpext_modules:: $(GPEXT_MODULES)
|
||||
|
||||
torture:: SHOWFLAGS $(TORTURE_PROGS)
|
||||
|
||||
smbtorture : SHOWFLAGS bin/smbtorture@EXEEXT@
|
||||
@ -1697,6 +1718,7 @@ LIBWBCLIENT_OBJ0 = nsswitch/libwbclient/wbclient.o \
|
||||
nsswitch/libwbclient/wbc_pwd.o \
|
||||
nsswitch/libwbclient/wbc_idmap.o \
|
||||
nsswitch/libwbclient/wbc_sid.o \
|
||||
nsswitch/libwbclient/wbc_guid.o \
|
||||
nsswitch/libwbclient/wbc_pam.o
|
||||
LIBWBCLIENT_OBJ = $(LIBWBCLIENT_OBJ0) \
|
||||
$(WBCOMMON_OBJ) \
|
||||
@ -2155,15 +2177,15 @@ bin/vlp@EXEEXT@: $(BINARY_PREREQS) $(VLP_OBJ) @LIBTALLOC_SHARED@ @LIBTDB_SHARED@
|
||||
$(LDAP_LIBS) $(KRB5LIBS) $(LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) \
|
||||
@SONAMEFLAG@`basename $@`@NSSSONAMEVERSIONSUFFIX@
|
||||
|
||||
bin/winbind_krb5_locator.@SHLIBEXT@: $(BINARY_PREREQS) $(WINBIND_KRB5_LOCATOR_OBJ)
|
||||
bin/winbind_krb5_locator.@SHLIBEXT@: $(BINARY_PREREQS) $(WINBIND_KRB5_LOCATOR_OBJ) @LIBWBCLIENT_SHARED@
|
||||
@echo "Linking $@"
|
||||
@$(SHLD) $(LDSHFLAGS) -o $@ $(WINBIND_KRB5_LOCATOR_OBJ) \
|
||||
@$(SHLD) $(LDSHFLAGS) -o $@ $(WINBIND_KRB5_LOCATOR_OBJ) $(WINBIND_LIBS) \
|
||||
@SONAMEFLAG@`basename $@`
|
||||
|
||||
bin/pam_winbind.@SHLIBEXT@: $(BINARY_PREREQS) $(PAM_WINBIND_OBJ)
|
||||
bin/pam_winbind.@SHLIBEXT@: $(BINARY_PREREQS) $(PAM_WINBIND_OBJ) @LIBTALLOC_SHARED@ @LIBWBCLIENT_SHARED@
|
||||
@echo "Linking shared library $@"
|
||||
@$(SHLD) $(LDSHFLAGS) -o $@ $(PAM_WINBIND_OBJ) -lpam @INIPARSERLIBS@ \
|
||||
$(PAM_WINBIND_EXTRA_LIBS) @SONAMEFLAG@`basename $@`
|
||||
$(PAM_WINBIND_EXTRA_LIBS) $(LIBTALLOC_LIBS) $(WINBIND_LIBS) @SONAMEFLAG@`basename $@`
|
||||
|
||||
bin/builtin.@SHLIBEXT@: $(BINARY_PREREQS) $(AUTH_BUILTIN_OBJ)
|
||||
@echo "Building plugin $@"
|
||||
@ -2177,6 +2199,10 @@ bin/script.@SHLIBEXT@: $(BINARY_PREREQS) $(AUTH_SCRIPT_OBJ)
|
||||
@echo "Building plugin $@"
|
||||
@$(SHLD_MODULE) $(AUTH_SCRIPT_OBJ)
|
||||
|
||||
bin/netlogond.@SHLIBEXT@: $(BINARY_PREREQS) $(AUTH_NETLOGOND_OBJ)
|
||||
@echo "Building plugin $@"
|
||||
@$(SHLD_MODULE) $(AUTH_NETLOGOND_OBJ)
|
||||
|
||||
bin/smbserver.@SHLIBEXT@: $(BINARY_PREREQS) $(AUTH_SERVER_OBJ)
|
||||
@echo "Building plugin $@"
|
||||
@$(SHLD_MODULE) $(AUTH_SERVER_OBJ)
|
||||
@ -2217,6 +2243,10 @@ bin/hash.@SHLIBEXT@: $(BINARY_PREREQS) $(IDMAP_HASH_OBJ)
|
||||
@echo "Building plugin $@"
|
||||
@$(SHLD_MODULE) $(IDMAP_HASH_OBJ)
|
||||
|
||||
bin/adex.@SHLIBEXT@: $(BINARY_PREREQS) $(IDMAP_ADEX_OBJ)
|
||||
@echo "Building plugin $@"
|
||||
@$(SHLD_MODULE) $(IDMAP_ADEX_OBJ)
|
||||
|
||||
bin/tdb2.@SHLIBEXT@: $(BINARY_PREREQS) winbindd/idmap_tdb2.o
|
||||
@echo "Building plugin $@"
|
||||
@$(SHLD_MODULE) winbindd/idmap_tdb2.o
|
||||
@ -2388,6 +2418,10 @@ bin/acl_xattr.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_ACL_XATTR_OBJ)
|
||||
@echo "Building plugin $@"
|
||||
@$(SHLD_MODULE) $(VFS_ACL_XATTR_OBJ)
|
||||
|
||||
bin/smb_traffic_analyzer.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_SMB_TRAFFIC_ANALYZER_OBJ)
|
||||
@echo "Building plugin $@"
|
||||
@$(SHLD_MODULE) $(VFS_SMB_TRAFFIC_ANALYZER_OBJ)
|
||||
|
||||
bin/registry.@SHLIBEXT@: $(BINARY_PREREQS) libgpo/gpext/registry.o
|
||||
@echo "Building plugin $@"
|
||||
@$(SHLD_MODULE) libgpo/gpext/registry.o
|
||||
@ -2396,6 +2430,10 @@ bin/scripts.@SHLIBEXT@: $(BINARY_PREREQS) libgpo/gpext/scripts.o
|
||||
@echo "Building plugin $@"
|
||||
@$(SHLD_MODULE) libgpo/gpext/scripts.o
|
||||
|
||||
bin/security.@SHLIBEXT@: $(BINARY_PREREQS) libgpo/gpext/security.o
|
||||
@echo "Building plugin $@"
|
||||
@$(SHLD_MODULE) libgpo/gpext/security.o
|
||||
|
||||
#########################################################
|
||||
## IdMap NSS plugins
|
||||
|
||||
@ -2468,6 +2506,13 @@ bin/rpc_open_tcp@EXEEXT@: $(BINARY_PREREQS) $(RPC_OPEN_TCP_OBJ) @LIBTALLOC_SHARE
|
||||
$(LIBS) $(LIBTALLOC_LIBS) @LIBTDB_SHARED@ $(WINBIND_LIBS) \
|
||||
$(LDAP_LIBS) $(KRB5LIBS) $(NSCD_LIBS)
|
||||
|
||||
bin/test_lp_load@EXEEXT@: $(BINARY_PREREQS) $(TEST_LP_LOAD_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@
|
||||
@echo "Linking $@"
|
||||
@$(CC) $(FLAGS) -o $@ $(TEST_LP_LOAD_OBJ) \
|
||||
$(LDFLAGS) $(DYNEEXP) $(LIBS) \
|
||||
$(LDAP_LIBS) \
|
||||
$(POPT_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
|
||||
|
||||
install:: installservers installbin @INSTALL_CIFSMOUNT@ @INSTALL_CIFSUPCALL@ installman \
|
||||
installscripts installdat installmodules @SWAT_INSTALL_TARGETS@ \
|
||||
@INSTALL_PAM_MODULES@ installlibs
|
||||
@ -2518,6 +2563,8 @@ installmodules:: modules installdirs
|
||||
@$(SHELL) $(srcdir)/script/linkmodules.sh $(DESTDIR)$(AUTHLIBDIR) domain.@SHLIBEXT@ trustdomain.@SHLIBEXT@ ntdomain.@SHLIBEXT@
|
||||
@$(SHELL) $(srcdir)/script/linkmodules.sh $(DESTDIR)$(AUTHLIBDIR) builtin.@SHLIBEXT@ guest.@SHLIBEXT@ fixed_challenge.@SHLIBEXT@ name_to_ntstatus.@SHLIBEXT@
|
||||
@$(SHELL) $(srcdir)/script/linkmodules.sh $(DESTDIR)$(NSSINFOLIBDIR) ../idmap/ad.@SHLIBEXT@ rfc2307.@SHLIBEXT@ sfu.@SHLIBEXT@ sfu20.@SHLIBEXT@
|
||||
@$(SHELL) $(srcdir)/script/linkmodules.sh $(DESTDIR)$(NSSINFOLIBDIR) ../idmap/adex.@SHLIBEXT@ adex.@SHLIBEXT@
|
||||
@$(SHELL) $(srcdir)/script/linkmodules.sh $(DESTDIR)$(NSSINFOLIBDIR) ../idmap/hash.@SHLIBEXT@ hash.@SHLIBEXT@
|
||||
|
||||
installscripts:: installdirs
|
||||
@$(SHELL) $(srcdir)/script/installscripts.sh $(INSTALLPERMS_BIN) $(DESTDIR)$(BINDIR) $(SCRIPTS)
|
||||
@ -2613,6 +2660,10 @@ uninstallpammodules::
|
||||
# Toplevel clean files
|
||||
TOPFILES=dynconfig.o
|
||||
|
||||
cleanlibs::
|
||||
-rm -f ../lib/*/*.o ../lib/*/*/*.o \
|
||||
../libcli/*.o ../libcli/*/*.o
|
||||
|
||||
clean:: cleanlibs
|
||||
-rm -f include/build_env.h
|
||||
-rm -f smbd/build_options.c
|
||||
@ -2636,10 +2687,10 @@ include/build_env.h: script/build_env.sh
|
||||
proto::
|
||||
|
||||
etags::
|
||||
etags `find $(srcdir) -name "*.[ch]"`
|
||||
etags `find $(srcdir)/.. -name "*.[ch]"`
|
||||
|
||||
ctags::
|
||||
ctags `find $(srcdir) -name "*.[ch]"`
|
||||
ctags `find $(srcdir)/.. -name "*.[ch]"`
|
||||
|
||||
realclean:: clean
|
||||
-rm -f config.log bin/.dummy script/findsmb script/gen-8bit-gap.sh
|
||||
@ -2723,6 +2774,10 @@ valgrindtest:: all torture timelimit
|
||||
VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
|
||||
PERL="$(PERL)" $(srcdir)/script/tests/selftest.sh ${selftest_prefix} all "${smbtorture4_path}"
|
||||
|
||||
# Check for Winbind struct 32/64bit padding
|
||||
test_wbpad:
|
||||
@echo "Testing winbind request/response structure for 32/64bit padding"
|
||||
@./script/tests/wb_pad.sh || exit 1;
|
||||
|
||||
##
|
||||
## Examples:
|
||||
|
@ -26,6 +26,71 @@
|
||||
extern bool global_machine_password_needs_changing;
|
||||
static struct named_mutex *mutex;
|
||||
|
||||
/*
|
||||
* Change machine password (called from main loop
|
||||
* idle timeout. Must be done as root.
|
||||
*/
|
||||
|
||||
void attempt_machine_password_change(void)
|
||||
{
|
||||
unsigned char trust_passwd_hash[16];
|
||||
time_t lct;
|
||||
void *lock;
|
||||
|
||||
if (!global_machine_password_needs_changing) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (lp_security() != SEC_DOMAIN) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* We're in domain level security, and the code that
|
||||
* read the machine password flagged that the machine
|
||||
* password needs changing.
|
||||
*/
|
||||
|
||||
/*
|
||||
* First, open the machine password file with an exclusive lock.
|
||||
*/
|
||||
|
||||
lock = secrets_get_trust_account_lock(NULL, lp_workgroup());
|
||||
|
||||
if (lock == NULL) {
|
||||
DEBUG(0,("attempt_machine_password_change: unable to lock "
|
||||
"the machine account password for machine %s in "
|
||||
"domain %s.\n",
|
||||
global_myname(), lp_workgroup() ));
|
||||
return;
|
||||
}
|
||||
|
||||
if(!secrets_fetch_trust_account_password(lp_workgroup(),
|
||||
trust_passwd_hash, &lct, NULL)) {
|
||||
DEBUG(0,("attempt_machine_password_change: unable to read the "
|
||||
"machine account password for %s in domain %s.\n",
|
||||
global_myname(), lp_workgroup()));
|
||||
TALLOC_FREE(lock);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure someone else hasn't already done this.
|
||||
*/
|
||||
|
||||
if(time(NULL) < lct + lp_machine_password_timeout()) {
|
||||
global_machine_password_needs_changing = false;
|
||||
TALLOC_FREE(lock);
|
||||
return;
|
||||
}
|
||||
|
||||
/* always just contact the PDC here */
|
||||
|
||||
change_trust_account_password( lp_workgroup(), NULL);
|
||||
global_machine_password_needs_changing = false;
|
||||
TALLOC_FREE(lock);
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to a remote server for (inter)domain security authenticaion.
|
||||
*
|
||||
|
321
source3/auth/auth_netlogond.c
Normal file
321
source3/auth/auth_netlogond.c
Normal file
@ -0,0 +1,321 @@
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
Authenticate against a netlogon pipe listening on a unix domain socket
|
||||
Copyright (C) Volker Lendecke 2008
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
#undef DBGC_CLASS
|
||||
#define DBGC_CLASS DBGC_AUTH
|
||||
|
||||
static NTSTATUS netlogond_validate(TALLOC_CTX *mem_ctx,
|
||||
const struct auth_context *auth_context,
|
||||
const char *ncalrpc_sockname,
|
||||
uint8_t schannel_key[16],
|
||||
const auth_usersupplied_info *user_info,
|
||||
struct netr_SamInfo3 **pinfo3,
|
||||
NTSTATUS *schannel_bind_result)
|
||||
{
|
||||
struct rpc_pipe_client *p;
|
||||
struct cli_pipe_auth_data *auth;
|
||||
struct netr_SamInfo3 *info3 = NULL;
|
||||
NTSTATUS status;
|
||||
|
||||
*schannel_bind_result = NT_STATUS_OK;
|
||||
|
||||
status = rpc_pipe_open_ncalrpc(talloc_tos(), ncalrpc_sockname,
|
||||
&ndr_table_netlogon.syntax_id, &p);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(10, ("rpc_pipe_open_ncalrpc failed: %s\n",
|
||||
nt_errstr(status)));
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpccli_schannel_bind_data(p, lp_workgroup(),
|
||||
PIPE_AUTH_LEVEL_PRIVACY,
|
||||
schannel_key, &auth);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(10, ("rpccli_schannel_bind_data failed: %s\n",
|
||||
nt_errstr(status)));
|
||||
TALLOC_FREE(p);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_pipe_bind(p, auth);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(10, ("rpc_pipe_bind failed: %s\n", nt_errstr(status)));
|
||||
TALLOC_FREE(p);
|
||||
*schannel_bind_result = status;
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* We have to fake a struct dcinfo, so that
|
||||
* rpccli_netlogon_sam_network_logon_ex can decrypt the session keys.
|
||||
*/
|
||||
|
||||
p->dc = talloc(p, struct dcinfo);
|
||||
if (p->dc == NULL) {
|
||||
DEBUG(0, ("talloc failed\n"));
|
||||
TALLOC_FREE(p);
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
memcpy(p->dc->sess_key, schannel_key, 16);
|
||||
|
||||
status = rpccli_netlogon_sam_network_logon_ex(
|
||||
p, p,
|
||||
user_info->logon_parameters,/* flags such as 'allow
|
||||
* workstation logon' */
|
||||
global_myname(), /* server name */
|
||||
user_info->smb_name, /* user name logging on. */
|
||||
user_info->client_domain, /* domain name */
|
||||
user_info->wksta_name, /* workstation name */
|
||||
(uchar *)auth_context->challenge.data, /* 8 byte challenge. */
|
||||
user_info->lm_resp, /* lanman 24 byte response */
|
||||
user_info->nt_resp, /* nt 24 byte response */
|
||||
&info3); /* info3 out */
|
||||
|
||||
DEBUG(10, ("rpccli_netlogon_sam_network_logon_ex returned %s\n",
|
||||
nt_errstr(status)));
|
||||
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
TALLOC_FREE(p);
|
||||
return status;
|
||||
}
|
||||
|
||||
*pinfo3 = talloc_move(mem_ctx, &info3);
|
||||
|
||||
TALLOC_FREE(p);
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
static char *mymachinepw(TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
fstring pwd;
|
||||
const char *script;
|
||||
char *to_free = NULL;
|
||||
ssize_t nread;
|
||||
int ret, fd;
|
||||
|
||||
script = lp_parm_const_string(
|
||||
GLOBAL_SECTION_SNUM, "auth_netlogond", "machinepwscript",
|
||||
NULL);
|
||||
|
||||
if (script == NULL) {
|
||||
to_free = talloc_asprintf(talloc_tos(), "%s/%s",
|
||||
get_dyn_SBINDIR(), "mymachinepw");
|
||||
script = to_free;
|
||||
}
|
||||
if (script == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = smbrun(script, &fd);
|
||||
DEBUG(ret ? 0 : 3, ("mymachinepw: Running the command `%s' gave %d\n",
|
||||
script, ret));
|
||||
TALLOC_FREE(to_free);
|
||||
|
||||
if (ret != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pwd[sizeof(pwd)-1] = '\0';
|
||||
|
||||
nread = read(fd, pwd, sizeof(pwd)-1);
|
||||
close(fd);
|
||||
|
||||
if (nread <= 0) {
|
||||
DEBUG(3, ("mymachinepwd: Could not read password\n"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DEBUG(0, ("pwd: %d [%s]\n", (int)nread, pwd));
|
||||
|
||||
if (pwd[nread-1] == '\n') {
|
||||
pwd[nread-1] = '\0';
|
||||
}
|
||||
|
||||
return talloc_strdup(mem_ctx, pwd);
|
||||
}
|
||||
|
||||
static NTSTATUS check_netlogond_security(const struct auth_context *auth_context,
|
||||
void *my_private_data,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
const auth_usersupplied_info *user_info,
|
||||
auth_serversupplied_info **server_info)
|
||||
{
|
||||
TALLOC_CTX *frame = talloc_stackframe();
|
||||
struct netr_SamInfo3 *info3 = NULL;
|
||||
struct rpc_pipe_client *p;
|
||||
struct cli_pipe_auth_data *auth;
|
||||
uint32_t neg_flags = NETLOGON_NEG_AUTH2_ADS_FLAGS;
|
||||
char *plaintext_machinepw;
|
||||
uint8_t machine_password[16];
|
||||
uint8_t schannel_key[16];
|
||||
NTSTATUS schannel_bind_result, status;
|
||||
struct named_mutex *mutex;
|
||||
const char *ncalrpcsock;
|
||||
|
||||
ncalrpcsock = lp_parm_const_string(
|
||||
GLOBAL_SECTION_SNUM, "auth_netlogond", "socket", NULL);
|
||||
|
||||
if (ncalrpcsock == NULL) {
|
||||
ncalrpcsock = talloc_asprintf(talloc_tos(), "%s/%s",
|
||||
get_dyn_NCALRPCDIR(), "DEFAULT");
|
||||
}
|
||||
|
||||
if (ncalrpcsock == NULL) {
|
||||
status = NT_STATUS_NO_MEMORY;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!secrets_fetch_local_schannel_key(schannel_key)) {
|
||||
goto new_key;
|
||||
}
|
||||
|
||||
status = netlogond_validate(talloc_tos(), auth_context, ncalrpcsock,
|
||||
schannel_key, user_info, &info3,
|
||||
&schannel_bind_result);
|
||||
|
||||
DEBUG(10, ("netlogond_validate returned %s\n", nt_errstr(status)));
|
||||
|
||||
if (NT_STATUS_IS_OK(status)) {
|
||||
goto okay;
|
||||
}
|
||||
|
||||
if (NT_STATUS_IS_OK(schannel_bind_result)) {
|
||||
/*
|
||||
* This is a real failure from the DC
|
||||
*/
|
||||
goto done;
|
||||
}
|
||||
|
||||
new_key:
|
||||
|
||||
mutex = grab_named_mutex(talloc_tos(), "LOCAL_SCHANNEL_KEY", 60);
|
||||
if (mutex == NULL) {
|
||||
DEBUG(10, ("Could not get mutex LOCAL_SCHANNEL_KEY\n"));
|
||||
status = NT_STATUS_ACCESS_DENIED;
|
||||
goto done;
|
||||
}
|
||||
|
||||
DEBUG(10, ("schannel bind failed, setting up new key\n"));
|
||||
|
||||
status = rpc_pipe_open_ncalrpc(talloc_tos(), ncalrpcsock,
|
||||
&ndr_table_netlogon.syntax_id, &p);
|
||||
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(10, ("rpc_pipe_open_ncalrpc failed: %s\n",
|
||||
nt_errstr(status)));
|
||||
goto done;
|
||||
}
|
||||
|
||||
status = rpccli_anon_bind_data(p, &auth);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(10, ("rpccli_anon_bind_data failed: %s\n",
|
||||
nt_errstr(status)));
|
||||
goto done;
|
||||
}
|
||||
|
||||
status = rpc_pipe_bind(p, auth);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(10, ("rpc_pipe_bind failed: %s\n", nt_errstr(status)));
|
||||
goto done;
|
||||
}
|
||||
|
||||
TALLOC_FREE(auth);
|
||||
|
||||
plaintext_machinepw = mymachinepw(talloc_tos());
|
||||
if (plaintext_machinepw == NULL) {
|
||||
status = NT_STATUS_NO_MEMORY;
|
||||
goto done;
|
||||
}
|
||||
|
||||
E_md4hash(plaintext_machinepw, machine_password);
|
||||
|
||||
TALLOC_FREE(plaintext_machinepw);
|
||||
|
||||
status = rpccli_netlogon_setup_creds(
|
||||
p, global_myname(), lp_workgroup(), global_myname(),
|
||||
global_myname(), machine_password, SEC_CHAN_BDC, &neg_flags);
|
||||
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(10, ("rpccli_netlogon_setup_creds failed: %s\n",
|
||||
nt_errstr(status)));
|
||||
goto done;
|
||||
}
|
||||
|
||||
memcpy(schannel_key, p->dc->sess_key, 16);
|
||||
secrets_store_local_schannel_key(schannel_key);
|
||||
|
||||
TALLOC_FREE(p);
|
||||
|
||||
/*
|
||||
* Retry the authentication with the mutex held. This way nobody else
|
||||
* can step on our toes.
|
||||
*/
|
||||
|
||||
status = netlogond_validate(talloc_tos(), auth_context, ncalrpcsock,
|
||||
schannel_key, user_info, &info3,
|
||||
&schannel_bind_result);
|
||||
|
||||
DEBUG(10, ("netlogond_validate returned %s\n", nt_errstr(status)));
|
||||
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
okay:
|
||||
|
||||
status = make_server_info_info3(mem_ctx, user_info->smb_name,
|
||||
user_info->domain, server_info,
|
||||
info3);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(10, ("make_server_info_info3 failed: %s\n",
|
||||
nt_errstr(status)));
|
||||
TALLOC_FREE(frame);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = NT_STATUS_OK;
|
||||
|
||||
done:
|
||||
TALLOC_FREE(frame);
|
||||
return status;
|
||||
}
|
||||
|
||||
/* module initialisation */
|
||||
static NTSTATUS auth_init_netlogond(struct auth_context *auth_context,
|
||||
const char *param,
|
||||
auth_methods **auth_method)
|
||||
{
|
||||
if (!make_auth_methods(auth_context, auth_method)) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
(*auth_method)->name = "netlogond";
|
||||
(*auth_method)->auth = check_netlogond_security;
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
NTSTATUS auth_netlogond_init(void)
|
||||
{
|
||||
smb_register_auth(AUTH_INTERFACE_VERSION, "netlogond",
|
||||
auth_init_netlogond);
|
||||
return NT_STATUS_OK;
|
||||
}
|
@ -2,6 +2,18 @@
|
||||
|
||||
# Run this script to build samba from GIT.
|
||||
|
||||
while true; do
|
||||
case $1 in
|
||||
(--version-file)
|
||||
VERSION_FILE=$2
|
||||
shift 2
|
||||
;;
|
||||
(*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
## insert all possible names (only works with
|
||||
## autoconf 2.x)
|
||||
TESTAUTOHEADER="autoheader autoheader-2.53 autoheader2.50 autoheader259 autoheader253"
|
||||
@ -48,7 +60,7 @@ if test "$AUTOCONFFOUND" = "0" -o "$AUTOHEADERFOUND" = "0"; then
|
||||
fi
|
||||
|
||||
echo "$0: running script/mkversion.sh"
|
||||
./script/mkversion.sh || exit 1
|
||||
./script/mkversion.sh $VERSION_FILE || exit 1
|
||||
|
||||
rm -rf autom4te*.cache
|
||||
rm -f configure include/config.h*
|
||||
|
@ -4345,6 +4345,8 @@ cleanup:
|
||||
}
|
||||
}
|
||||
|
||||
static bool finished;
|
||||
|
||||
/****************************************************************************
|
||||
Make sure we swallow keepalives during idle time.
|
||||
****************************************************************************/
|
||||
@ -4391,6 +4393,8 @@ static void readline_callback(void)
|
||||
DEBUG(0, ("Read from server failed, maybe it closed "
|
||||
"the connection\n"));
|
||||
|
||||
finished = true;
|
||||
smb_readline_done();
|
||||
if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) {
|
||||
set_smb_read_error(&cli->smb_rw_error,
|
||||
SMB_READ_EOF);
|
||||
@ -4417,9 +4421,17 @@ static void readline_callback(void)
|
||||
|
||||
/* Ping the server to keep the connection alive using SMBecho. */
|
||||
{
|
||||
NTSTATUS status;
|
||||
unsigned char garbage[16];
|
||||
memset(garbage, 0xf0, sizeof(garbage));
|
||||
cli_echo(cli, 1, data_blob_const(garbage, sizeof(garbage)));
|
||||
status = cli_echo(cli, 1, data_blob_const(garbage, sizeof(garbage)));
|
||||
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(0, ("SMBecho failed. Maybe server has closed "
|
||||
"the connection\n"));
|
||||
finished = true;
|
||||
smb_readline_done();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4431,7 +4443,7 @@ static int process_stdin(void)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
while (1) {
|
||||
while (!finished) {
|
||||
TALLOC_CTX *frame = talloc_stackframe();
|
||||
char *tok = NULL;
|
||||
char *the_prompt = NULL;
|
||||
|
@ -56,6 +56,10 @@
|
||||
#endif /* _SAMBA_BUILD_ */
|
||||
#endif /* MOUNT_CIFS_VENDOR_SUFFIX */
|
||||
|
||||
#ifdef _SAMBA_BUILD_
|
||||
#include "include/config.h"
|
||||
#endif
|
||||
|
||||
#ifndef MS_MOVE
|
||||
#define MS_MOVE 8192
|
||||
#endif
|
||||
@ -75,6 +79,15 @@
|
||||
#define MOUNT_PASSWD_SIZE 64
|
||||
#define DOMAIN_SIZE 64
|
||||
|
||||
/* exit status - bits below are ORed */
|
||||
#define EX_USAGE 1 /* incorrect invocation or permission */
|
||||
#define EX_SYSERR 2 /* out of memory, cannot fork, ... */
|
||||
#define EX_SOFTWARE 4 /* internal mount bug or wrong version */
|
||||
#define EX_USER 8 /* user interrupt */
|
||||
#define EX_FILEIO 16 /* problems writing, locking, ... mtab/fstab */
|
||||
#define EX_FAIL 32 /* mount failure */
|
||||
#define EX_SOMEOK 64 /* some mount succeeded */
|
||||
|
||||
const char *thisprogram;
|
||||
int verboseflag = 0;
|
||||
static int got_password = 0;
|
||||
@ -94,6 +107,8 @@ char * prefixpath = NULL;
|
||||
|
||||
/* like strncpy but does not 0 fill the buffer and always null
|
||||
* terminates. bufsize is the size of the destination buffer */
|
||||
|
||||
#ifndef HAVE_STRLCPY
|
||||
static size_t strlcpy(char *d, const char *s, size_t bufsize)
|
||||
{
|
||||
size_t len = strlen(s);
|
||||
@ -104,10 +119,13 @@ static size_t strlcpy(char *d, const char *s, size_t bufsize)
|
||||
d[len] = 0;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* like strncat but does not 0 fill the buffer and always null
|
||||
* terminates. bufsize is the length of the buffer, which should
|
||||
* be one more than the maximum resulting string length */
|
||||
|
||||
#ifndef HAVE_STRLCAT
|
||||
static size_t strlcat(char *d, const char *s, size_t bufsize)
|
||||
{
|
||||
size_t len1 = strlen(d);
|
||||
@ -126,6 +144,7 @@ static size_t strlcat(char *d, const char *s, size_t bufsize)
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* BB finish BB
|
||||
|
||||
@ -164,7 +183,7 @@ static void mount_cifs_usage(void)
|
||||
printf("\n\t%s -V\n",thisprogram);
|
||||
|
||||
SAFE_FREE(mountpassword);
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
||||
/* caller frees username if necessary */
|
||||
@ -223,7 +242,7 @@ static int open_cred_file(char * file_name)
|
||||
if(length > 4086) {
|
||||
printf("mount.cifs failed due to malformed username in credentials file");
|
||||
memset(line_buf,0,4096);
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
} else {
|
||||
got_user = 1;
|
||||
user_name = (char *)calloc(1 + length,1);
|
||||
@ -247,7 +266,7 @@ static int open_cred_file(char * file_name)
|
||||
if(length > MOUNT_PASSWD_SIZE) {
|
||||
printf("mount.cifs failed: password in credentials file too long\n");
|
||||
memset(line_buf,0, 4096);
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
} else {
|
||||
if(mountpassword == NULL) {
|
||||
mountpassword = (char *)calloc(MOUNT_PASSWD_SIZE+1,1);
|
||||
@ -275,7 +294,7 @@ static int open_cred_file(char * file_name)
|
||||
}
|
||||
if(length > DOMAIN_SIZE) {
|
||||
printf("mount.cifs failed: domain in credentials file too long\n");
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
} else {
|
||||
if(domain_name == NULL) {
|
||||
domain_name = (char *)calloc(DOMAIN_SIZE+1,1);
|
||||
@ -308,7 +327,7 @@ static int get_password_from_file(int file_descript, char * filename)
|
||||
|
||||
if (mountpassword == NULL) {
|
||||
printf("malloc failed\n");
|
||||
exit(1);
|
||||
exit(EX_SYSERR);
|
||||
}
|
||||
|
||||
if(filename != NULL) {
|
||||
@ -316,7 +335,7 @@ static int get_password_from_file(int file_descript, char * filename)
|
||||
if(file_descript < 0) {
|
||||
printf("mount.cifs failed. %s attempting to open password file %s\n",
|
||||
strerror(errno),filename);
|
||||
exit(1);
|
||||
exit(EX_SYSERR);
|
||||
}
|
||||
}
|
||||
/* else file already open and fd provided */
|
||||
@ -327,7 +346,7 @@ static int get_password_from_file(int file_descript, char * filename)
|
||||
printf("mount.cifs failed. Error %s reading password file\n",strerror(errno));
|
||||
if(filename != NULL)
|
||||
close(file_descript);
|
||||
exit(1);
|
||||
exit(EX_SYSERR);
|
||||
} else if(rc == 0) {
|
||||
if(mountpassword[0] == 0) {
|
||||
if(verboseflag)
|
||||
@ -553,7 +572,7 @@ static int parse_options(char ** optionsp, int * filesys_flags)
|
||||
|
||||
if (!(pw = getpwnam(value))) {
|
||||
printf("bad user name \"%s\"\n", value);
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
snprintf(user, sizeof(user), "%u", pw->pw_uid);
|
||||
} else {
|
||||
@ -569,7 +588,7 @@ static int parse_options(char ** optionsp, int * filesys_flags)
|
||||
|
||||
if (!(gr = getgrnam(value))) {
|
||||
printf("bad group name \"%s\"\n", value);
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
snprintf(group, sizeof(group), "%u", gr->gr_gid);
|
||||
} else {
|
||||
@ -664,7 +683,7 @@ static int parse_options(char ** optionsp, int * filesys_flags)
|
||||
out = (char *)realloc(out, out_len + word_len + 2);
|
||||
if (out == NULL) {
|
||||
perror("malloc");
|
||||
exit(1);
|
||||
exit(EX_SYSERR);
|
||||
}
|
||||
|
||||
if (out_len) {
|
||||
@ -689,7 +708,7 @@ nocopy:
|
||||
out = (char *)realloc(out, out_len + word_len + 6);
|
||||
if (out == NULL) {
|
||||
perror("malloc");
|
||||
exit(1);
|
||||
exit(EX_SYSERR);
|
||||
}
|
||||
|
||||
if (out_len) {
|
||||
@ -705,7 +724,7 @@ nocopy:
|
||||
out = (char *)realloc(out, out_len + 1 + word_len + 6);
|
||||
if (out == NULL) {
|
||||
perror("malloc");
|
||||
exit(1);
|
||||
exit(EX_SYSERR);
|
||||
}
|
||||
|
||||
if (out_len) {
|
||||
@ -986,12 +1005,12 @@ static struct option longopts[] = {
|
||||
};
|
||||
|
||||
/* convert a string to uppercase. return false if the string
|
||||
* wasn't ASCII or was a NULL ptr */
|
||||
* wasn't ASCII. Return success on a NULL ptr */
|
||||
static int
|
||||
uppercase_string(char *string)
|
||||
{
|
||||
if (!string)
|
||||
return 0;
|
||||
return 1;
|
||||
|
||||
while (*string) {
|
||||
/* check for unicode */
|
||||
@ -1040,7 +1059,7 @@ int main(int argc, char ** argv)
|
||||
thisprogram = argv[0];
|
||||
} else {
|
||||
mount_cifs_usage();
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
||||
if(thisprogram == NULL)
|
||||
@ -1057,12 +1076,12 @@ int main(int argc, char ** argv)
|
||||
share_name = strndup(argv[1], MAX_UNC_LEN);
|
||||
if (share_name == NULL) {
|
||||
fprintf(stderr, "%s: %s", argv[0], strerror(ENOMEM));
|
||||
exit(1);
|
||||
exit(EX_SYSERR);
|
||||
}
|
||||
mountpoint = argv[2];
|
||||
} else {
|
||||
mount_cifs_usage();
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
||||
/* add sharename in opts string as unc= parm */
|
||||
@ -1084,7 +1103,7 @@ int main(int argc, char ** argv)
|
||||
case '?':
|
||||
case 'h': /* help */
|
||||
mount_cifs_usage ();
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
case 'n':
|
||||
++nomtab;
|
||||
break;
|
||||
@ -1138,14 +1157,14 @@ int main(int argc, char ** argv)
|
||||
uid = strtoul(optarg, &ep, 10);
|
||||
if (*ep) {
|
||||
printf("bad uid value \"%s\"\n", optarg);
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
} else {
|
||||
struct passwd *pw;
|
||||
|
||||
if (!(pw = getpwnam(optarg))) {
|
||||
printf("bad user name \"%s\"\n", optarg);
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
uid = pw->pw_uid;
|
||||
endpwent();
|
||||
@ -1158,14 +1177,14 @@ int main(int argc, char ** argv)
|
||||
gid = strtoul(optarg, &ep, 10);
|
||||
if (*ep) {
|
||||
printf("bad gid value \"%s\"\n", optarg);
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
} else {
|
||||
struct group *gr;
|
||||
|
||||
if (!(gr = getgrnam(optarg))) {
|
||||
printf("bad user name \"%s\"\n", optarg);
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
gid = gr->gr_gid;
|
||||
endpwent();
|
||||
@ -1195,13 +1214,13 @@ int main(int argc, char ** argv)
|
||||
default:
|
||||
printf("unknown mount option %c\n",c);
|
||||
mount_cifs_usage();
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
}
|
||||
|
||||
if((argc < 3) || (dev_name == NULL) || (mountpoint == NULL)) {
|
||||
mount_cifs_usage();
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
||||
if (getenv("PASSWD")) {
|
||||
@ -1218,13 +1237,13 @@ int main(int argc, char ** argv)
|
||||
}
|
||||
|
||||
if (orgoptions && parse_options(&orgoptions, &flags)) {
|
||||
rc = -1;
|
||||
rc = EX_USAGE;
|
||||
goto mount_exit;
|
||||
}
|
||||
ipaddr = parse_server(&share_name);
|
||||
if((ipaddr == NULL) && (got_ip == 0)) {
|
||||
printf("No ip address specified and hostname not found\n");
|
||||
rc = -1;
|
||||
rc = EX_USAGE;
|
||||
goto mount_exit;
|
||||
}
|
||||
|
||||
@ -1239,19 +1258,19 @@ int main(int argc, char ** argv)
|
||||
}
|
||||
if(chdir(mountpoint)) {
|
||||
printf("mount error: can not change directory into mount target %s\n",mountpoint);
|
||||
rc = -1;
|
||||
rc = EX_USAGE;
|
||||
goto mount_exit;
|
||||
}
|
||||
|
||||
if(stat (".", &statbuf)) {
|
||||
printf("mount error: mount point %s does not exist\n",mountpoint);
|
||||
rc = -1;
|
||||
rc = EX_USAGE;
|
||||
goto mount_exit;
|
||||
}
|
||||
|
||||
if (S_ISDIR(statbuf.st_mode) == 0) {
|
||||
printf("mount error: mount point %s is not a directory\n",mountpoint);
|
||||
rc = -1;
|
||||
rc = EX_USAGE;
|
||||
goto mount_exit;
|
||||
}
|
||||
|
||||
@ -1264,7 +1283,7 @@ int main(int argc, char ** argv)
|
||||
#endif
|
||||
} else {
|
||||
printf("mount error: permission denied or not superuser and mount.cifs not installed SUID\n");
|
||||
return -1;
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1279,7 +1298,7 @@ int main(int argc, char ** argv)
|
||||
mountpassword = (char *)calloc(MOUNT_PASSWD_SIZE+1,1);
|
||||
if (!tmp_pass || !mountpassword) {
|
||||
printf("Password not entered, exiting\n");
|
||||
return -1;
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
strlcpy(mountpassword, tmp_pass, MOUNT_PASSWD_SIZE+1);
|
||||
got_password = 1;
|
||||
@ -1297,7 +1316,7 @@ mount_retry:
|
||||
else {
|
||||
printf("No server share name specified\n");
|
||||
printf("\nMounting the DFS root for server not implemented yet\n");
|
||||
exit(1);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
if(user_name)
|
||||
optlen += strlen(user_name) + 6;
|
||||
@ -1311,7 +1330,7 @@ mount_retry:
|
||||
|
||||
if(options == NULL) {
|
||||
printf("Could not allocate memory for mount options\n");
|
||||
return -1;
|
||||
exit(EX_SYSERR);
|
||||
}
|
||||
|
||||
options[0] = 0;
|
||||
@ -1390,8 +1409,7 @@ mount_retry:
|
||||
printf("mount error %d = %s\n",errno,strerror(errno));
|
||||
}
|
||||
printf("Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)\n");
|
||||
rc = -1;
|
||||
goto mount_exit;
|
||||
rc = EX_FAIL;
|
||||
} else {
|
||||
pmntfile = setmntent(MOUNTED, "a+");
|
||||
if(pmntfile) {
|
||||
@ -1429,11 +1447,13 @@ mount_retry:
|
||||
rc = addmntent(pmntfile,&mountent);
|
||||
endmntent(pmntfile);
|
||||
SAFE_FREE(mountent.mnt_opts);
|
||||
if (rc)
|
||||
rc = EX_FILEIO;
|
||||
} else {
|
||||
printf("could not update mount table\n");
|
||||
printf("could not update mount table\n");
|
||||
rc = EX_FILEIO;
|
||||
}
|
||||
}
|
||||
rc = 0;
|
||||
mount_exit:
|
||||
if(mountpassword) {
|
||||
int len = strlen(mountpassword);
|
||||
@ -1445,5 +1465,5 @@ mount_exit:
|
||||
SAFE_FREE(orgoptions);
|
||||
SAFE_FREE(resolved_path);
|
||||
SAFE_FREE(share_name);
|
||||
return rc;
|
||||
exit(rc);
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ fi
|
||||
if test "x$debug" = "xyes" ; then
|
||||
CFLAGS="${CFLAGS} -g"
|
||||
else
|
||||
CFLAGS="-O"
|
||||
CFLAGS="${CFLAGS} -O"
|
||||
fi
|
||||
|
||||
m4_include(../lib/socket_wrapper/config.m4)
|
||||
@ -404,10 +404,10 @@ AC_SUBST(DYNEXP)
|
||||
|
||||
dnl Add modules that have to be built by default here
|
||||
dnl These have to be built static:
|
||||
default_static_modules="pdb_smbpasswd pdb_tdbsam rpc_lsarpc rpc_samr rpc_winreg rpc_initshutdown rpc_dssetup rpc_wkssvc rpc_svcctl2 rpc_ntsvcs2 rpc_netlogon rpc_netdfs rpc_srvsvc rpc_spoolss rpc_eventlog2 auth_sam auth_unix auth_winbind auth_server auth_domain auth_builtin vfs_default nss_info_template"
|
||||
default_static_modules="pdb_smbpasswd pdb_tdbsam rpc_lsarpc rpc_samr rpc_winreg rpc_initshutdown rpc_dssetup rpc_wkssvc rpc_svcctl2 rpc_ntsvcs2 rpc_netlogon rpc_netdfs rpc_srvsvc rpc_spoolss rpc_eventlog2 auth_sam auth_unix auth_winbind auth_server auth_domain auth_builtin auth_netlogond vfs_default nss_info_template"
|
||||
|
||||
dnl These are preferably build shared, and static if dlopen() is not available
|
||||
default_shared_modules="vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2 charset_CP850 charset_CP437 auth_script vfs_readahead vfs_xattr_tdb vfs_streams_xattr vfs_acl_xattr"
|
||||
default_shared_modules="vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2 charset_CP850 charset_CP437 auth_script vfs_readahead vfs_xattr_tdb vfs_streams_xattr vfs_acl_xattr vfs_smb_traffic_analyzer"
|
||||
|
||||
if test "x$developer" = xyes; then
|
||||
default_static_modules="$default_static_modules rpc_rpcecho"
|
||||
@ -6058,6 +6058,7 @@ SMB_MODULE(idmap_nss, winbindd/idmap_nss.o, "bin/nss.$SHLIBEXT", IDMAP)
|
||||
SMB_MODULE(idmap_rid, winbindd/idmap_rid.o, "bin/rid.$SHLIBEXT", IDMAP)
|
||||
SMB_MODULE(idmap_ad, winbindd/idmap_ad.o, "bin/ad.$SHLIBEXT", IDMAP)
|
||||
SMB_MODULE(idmap_hash, \$(IDMAP_HASH_OBJ), "bin/hash.$SHLIBEXT", IDMAP)
|
||||
SMB_MODULE(idmap_adex, \$(IDMAP_ADEX_OBJ), "bin/adex.$SHLIBEXT", IDMAP)
|
||||
SMB_SUBSYSTEM(IDMAP, winbindd/idmap.o)
|
||||
|
||||
SMB_MODULE(nss_info_template, winbindd/nss_info_template.o, "bin/template.$SHLIBEXT", NSS_INFO)
|
||||
@ -6076,6 +6077,7 @@ SMB_MODULE(auth_server, \$(AUTH_SERVER_OBJ), "bin/smbserver.$SHLIBEXT", AUTH)
|
||||
SMB_MODULE(auth_domain, \$(AUTH_DOMAIN_OBJ), "bin/domain.$SHLIBEXT", AUTH)
|
||||
SMB_MODULE(auth_builtin, \$(AUTH_BUILTIN_OBJ), "bin/builtin.$SHLIBEXT", AUTH)
|
||||
SMB_MODULE(auth_script, \$(AUTH_SCRIPT_OBJ), "bin/script.$SHLIBEXT", AUTH)
|
||||
SMB_MODULE(auth_netlogond, \$(AUTH_NETLOGOND_OBJ), "bin/netlogond.$SHLIBEXT", AUTH)
|
||||
SMB_SUBSYSTEM(AUTH,auth/auth.o)
|
||||
|
||||
SMB_MODULE(vfs_default, \$(VFS_DEFAULT_OBJ), "bin/default.$SHLIBEXT", VFS)
|
||||
@ -6115,12 +6117,13 @@ SMB_MODULE(vfs_syncops, \$(VFS_SYNCOPS_OBJ), "bin/syncops.$SHLIBEXT", VFS)
|
||||
SMB_MODULE(vfs_zfsacl, \$(VFS_ZFSACL_OBJ), "bin/zfsacl.$SHLIBEXT", VFS)
|
||||
SMB_MODULE(vfs_notify_fam, \$(VFS_NOTIFY_FAM_OBJ), "bin/notify_fam.$SHLIBEXT", VFS)
|
||||
SMB_MODULE(vfs_acl_xattr, \$(VFS_ACL_XATTR_OBJ), "bin/acl_xattr.$SHLIBEXT", VFS)
|
||||
|
||||
SMB_MODULE(vfs_smb_traffic_analyzer, \$(VFS_SMB_TRAFFIC_ANALYZER_OBJ), "bin/smb_traffic_analyzer.$SHLIBEXT", VFS)
|
||||
|
||||
SMB_SUBSYSTEM(VFS,smbd/vfs.o)
|
||||
|
||||
SMB_MODULE(gpext_registry, libgpo/gpext/registry.o, "bin/registry.$SHLIBEXT", GPEXT)
|
||||
SMB_MODULE(gpext_scripts, libgpo/gpext/scripts.o, "bin/scripts.$SHLIBEXT", GPEXT)
|
||||
SMB_MODULE(gpext_security, libgpo/gpext/security.o, "bin/security.$SHLIBEXT", GPEXT)
|
||||
SMB_SUBSYSTEM(GPEXT, libgpo/gpext/gpext.o)
|
||||
|
||||
AC_DEFINE_UNQUOTED(STRING_STATIC_MODULES, "$string_static_modules", [String list of builtin modules])
|
||||
@ -6271,8 +6274,14 @@ fi
|
||||
SMBD_LIBS="$samba_dmapi_libs"
|
||||
AC_SUBST(SMBD_LIBS)
|
||||
|
||||
CFLAGS="${CFLAGS} \$(FLAGS)"
|
||||
|
||||
if test x$MERGED_BUILD != x1; then
|
||||
CFLAGS="${CFLAGS} \$(FLAGS) -D_SAMBA_BUILD_=3"
|
||||
CFLAGS="${CFLAGS} -D_SAMBA_BUILD_=3"
|
||||
else
|
||||
if test x"$BLDSHARED" = x"true" ; then
|
||||
LDFLAGS="$LDFLAGS -L./bin"
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_OUTPUT(Makefile
|
||||
|
@ -77,6 +77,7 @@ DEFINE_DYN_CONFIG_PARAM(MODULESDIR)
|
||||
DEFINE_DYN_CONFIG_PARAM(SHLIBEXT)
|
||||
DEFINE_DYN_CONFIG_PARAM(LOCKDIR)
|
||||
DEFINE_DYN_CONFIG_PARAM(PIDDIR)
|
||||
DEFINE_DYN_CONFIG_PARAM(NCALRPCDIR)
|
||||
DEFINE_DYN_CONFIG_PARAM(SMB_PASSWD_FILE)
|
||||
DEFINE_DYN_CONFIG_PARAM(PRIVATE_DIR)
|
||||
|
||||
|
@ -666,8 +666,7 @@ static NTSTATUS del_aliasmem(const DOM_SID *alias, const DOM_SID *member)
|
||||
|
||||
if (num == 0) {
|
||||
status = dbwrap_delete_bystring(db, key);
|
||||
TALLOC_FREE(sids);
|
||||
goto cancel;
|
||||
goto commit;
|
||||
}
|
||||
|
||||
member_string = talloc_strdup(sids, "");
|
||||
@ -693,7 +692,7 @@ static NTSTATUS del_aliasmem(const DOM_SID *alias, const DOM_SID *member)
|
||||
|
||||
status = dbwrap_store_bystring(
|
||||
db, key, string_term_tdb_data(member_string), 0);
|
||||
|
||||
commit:
|
||||
TALLOC_FREE(sids);
|
||||
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
|
@ -18,6 +18,8 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
struct smb_iconv_convenience;
|
||||
|
||||
/* this defines the charset types used in samba */
|
||||
typedef enum {CH_UTF16LE=0, CH_UTF16=0, CH_UNIX=1, CH_DISPLAY=2, CH_DOS=3, CH_UTF8=4, CH_UTF16BE=5} charset_t;
|
||||
|
||||
|
@ -71,6 +71,10 @@ const char *get_dyn_PIDDIR(void);
|
||||
const char *set_dyn_PIDDIR(const char *newpath);
|
||||
bool is_default_dyn_PIDDIR(void);
|
||||
|
||||
const char *get_dyn_NCALRPCDIR(void);
|
||||
const char *set_dyn_NCALRPCDIR(const char *newpath);
|
||||
bool is_default_dyn_NCALRPCDIR(void);
|
||||
|
||||
const char *get_dyn_SMB_PASSWD_FILE(void);
|
||||
const char *set_dyn_SMB_PASSWD_FILE(const char *newpath);
|
||||
bool is_default_dyn_SMB_PASSWD_FILE(void);
|
||||
|
@ -1,29 +0,0 @@
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
Interface header: Scheduler service
|
||||
Copyright (C) Luke Kenneth Casson Leighton 1996-1999
|
||||
Copyright (C) Andrew Tridgell 1992-1999
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _HMAC_MD5_H
|
||||
|
||||
typedef struct {
|
||||
struct MD5Context ctx;
|
||||
unsigned char k_ipad[65];
|
||||
unsigned char k_opad[65];
|
||||
} HMACMD5Context;
|
||||
|
||||
#endif /* _HMAC_MD5_H */
|
@ -31,8 +31,9 @@
|
||||
Updated to 3 for enum types by JRA. */
|
||||
|
||||
/* Updated to 4, completely new interface, SSS */
|
||||
/* Updated to 5, simplified interface by Volker */
|
||||
|
||||
#define SMB_IDMAP_INTERFACE_VERSION 4
|
||||
#define SMB_IDMAP_INTERFACE_VERSION 5
|
||||
|
||||
struct idmap_domain {
|
||||
const char *name;
|
||||
|
@ -686,8 +686,9 @@ typedef char fstring[FSTRING_LEN];
|
||||
#include "authdata.h"
|
||||
#include "msdfs.h"
|
||||
#include "rap.h"
|
||||
#include "md5.h"
|
||||
#include "hmacmd5.h"
|
||||
#include "../lib/crypto/md5.h"
|
||||
#include "../lib/crypto/crc32.h"
|
||||
#include "../lib/crypto/hmacmd5.h"
|
||||
#include "ntlmssp.h"
|
||||
#include "auth.h"
|
||||
#include "ntdomain.h"
|
||||
@ -703,6 +704,7 @@ typedef char fstring[FSTRING_LEN];
|
||||
#include "librpc/gen_ndr/notify.h"
|
||||
#include "librpc/gen_ndr/xattr.h"
|
||||
#include "librpc/gen_ndr/messaging.h"
|
||||
#include "librpc/gen_ndr/ndr_nbt.h"
|
||||
#include "librpc/rpc/dcerpc.h"
|
||||
#include "nt_printing.h"
|
||||
#include "idmap.h"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,73 +0,0 @@
|
||||
/*
|
||||
* Unix SMB/CIFS implementation.
|
||||
* MS-RPC client internal definitions
|
||||
* Copyright (C) Chris Nicholls 2005.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBMSRPC_INTERNAL_H
|
||||
#define LIBMSRPC_INTERNAL_H
|
||||
|
||||
#include "libmsrpc.h"
|
||||
|
||||
/*definitions*/
|
||||
|
||||
struct CacServerHandleInternal {
|
||||
/*stores the os type of the server*/
|
||||
uint16 srv_level;
|
||||
|
||||
/*stores the initialized/active pipes*/
|
||||
bool pipes[PI_MAX_PIPES];
|
||||
|
||||
/*underlying smbc context*/
|
||||
SMBCCTX *ctx;
|
||||
|
||||
/*did the user supply this SMBCCTX?*/
|
||||
bool user_supplied_ctx;
|
||||
};
|
||||
|
||||
/*used to get a struct rpc_pipe_client* to be passed into rpccli* calls*/
|
||||
|
||||
/*nessecary prototypes*/
|
||||
bool rid_in_list(uint32 rid, uint32 *list, uint32 list_len);
|
||||
|
||||
int cac_ParseRegPath(char *path, uint32 *reg_type, char **key_name);
|
||||
|
||||
REG_VALUE_DATA *cac_MakeRegValueData(TALLOC_CTX *mem_ctx, uint32 data_type, REGVAL_BUFFER buf);
|
||||
|
||||
RPC_DATA_BLOB *cac_MakeRpcDataBlob(TALLOC_CTX *mem_ctx, uint32 data_type, REG_VALUE_DATA data);
|
||||
|
||||
SAM_USERINFO_CTR *cac_MakeUserInfoCtr(TALLOC_CTX *mem_ctx, CacUserInfo *info);
|
||||
|
||||
CacUserInfo *cac_MakeUserInfo(TALLOC_CTX *mem_ctx, SAM_USERINFO_CTR *ctr);
|
||||
CacGroupInfo *cac_MakeGroupInfo(TALLOC_CTX *mem_ctx, GROUP_INFO_CTR *ctr);
|
||||
GROUP_INFO_CTR *cac_MakeGroupInfoCtr(TALLOC_CTX *mem_ctx, CacGroupInfo *info);
|
||||
CacAliasInfo *cac_MakeAliasInfo(TALLOC_CTX *mem_ctx, ALIAS_INFO_CTR ctr);
|
||||
ALIAS_INFO_CTR *cac_MakeAliasInfoCtr(TALLOC_CTX *mem_ctx, CacAliasInfo *info);
|
||||
CacDomainInfo *cac_MakeDomainInfo(TALLOC_CTX *mem_ctx, SAM_UNK_INFO_1 *info1, SAM_UNK_INFO_2 *info2, SAM_UNK_INFO_12 *info12);
|
||||
CacService *cac_MakeServiceArray(TALLOC_CTX *mem_ctx, ENUM_SERVICES_STATUS *svc, uint32 num_services);
|
||||
int cac_InitCacServiceConfig(TALLOC_CTX *mem_ctx, SERVICE_CONFIG *src, CacServiceConfig *dest);
|
||||
|
||||
/*moved to libmsrpc.h*/
|
||||
/*struct rpc_pipe_client *cac_GetPipe(CacServerHandle *hnd, int pi_idx);*/
|
||||
|
||||
SMBCSRV *smbc_attr_server(SMBCCTX *context,
|
||||
const char *server, const char *share,
|
||||
fstring workgroup,
|
||||
fstring username, fstring password,
|
||||
POLICY_HND *pol);
|
||||
|
||||
|
||||
#endif /* LIBMSRPC_INTERNAL_H */
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user