summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcvs2svn Import User <samba-bugs@samba.org>2003-03-31 03:07:14 +0000
committercvs2svn Import User <samba-bugs@samba.org>2003-03-31 03:07:14 +0000
commite032f762caa275f31059a5b4fce1410ba2a68181 (patch)
treed63b36a2a21879543b49426a582675344e7f1455
parent42d76f44c0be90b4f78a568a577672cacf800639 (diff)
downloadsamba-e032f762caa275f31059a5b4fce1410ba2a68181.tar.gz
samba-e032f762caa275f31059a5b4fce1410ba2a68181.tar.xz
samba-e032f762caa275f31059a5b4fce1410ba2a68181.zip
This commit was manufactured by cvs2svn to create tagsamba-3.0.0alpha23
'release-3-0alpha23'.
-rw-r--r--docs/docbook/smbdotconf/base/adsserver.xml15
-rw-r--r--docs/docbook/smbdotconf/base/bindinterfacesonly.xml71
-rw-r--r--docs/docbook/smbdotconf/base/comment.xml18
-rw-r--r--docs/docbook/smbdotconf/base/directory.xml9
-rw-r--r--docs/docbook/smbdotconf/base/displaycharset.xml16
-rw-r--r--docs/docbook/smbdotconf/base/doscharset.xml16
-rw-r--r--docs/docbook/smbdotconf/base/interfaces.xml51
-rw-r--r--docs/docbook/smbdotconf/base/netbiosaliases.xml20
-rw-r--r--docs/docbook/smbdotconf/base/netbiosname.xml20
-rw-r--r--docs/docbook/smbdotconf/base/netbiosscope.xml10
-rw-r--r--docs/docbook/smbdotconf/base/path.xml31
-rw-r--r--docs/docbook/smbdotconf/base/realm.xml15
-rw-r--r--docs/docbook/smbdotconf/base/serverstring.xml24
-rw-r--r--docs/docbook/smbdotconf/base/unixcharset.xml15
-rw-r--r--docs/docbook/smbdotconf/base/workgroup.xml16
-rwxr-xr-xdocs/docbook/smbdotconf/generate-file-list.sh8
-rw-r--r--docs/docbook/smbdotconf/smbconf.dtd10
-rw-r--r--docs/docbook/smbdotconf/split-original-smb.conf.xsl78
-rwxr-xr-xsource/client/mount.cifs.c557
-rw-r--r--source/include/popt_common.h48
-rw-r--r--source/libsmb/trustdom_cache.c215
-rw-r--r--source/modules/vfs_fake_perms.c287
-rw-r--r--source/passdb/privileges.c341
-rw-r--r--source/stf/.cvsignore1
-rw-r--r--source/stf/README.stf3
-rwxr-xr-xsource/stf/info3cache.py54
-rw-r--r--source/stf/notes.txt175
-rwxr-xr-xsource/stf/osver.py55
-rwxr-xr-xsource/stf/spoolss.py288
-rw-r--r--source/stf/standardcheck.py33
-rwxr-xr-xsource/stf/stf.py101
-rwxr-xr-xsource/stf/strings.py69
-rwxr-xr-xsource/stf/test.py33
-rw-r--r--source/torture/t_stringoverflow.c23
34 files changed, 0 insertions, 2726 deletions
diff --git a/docs/docbook/smbdotconf/base/adsserver.xml b/docs/docbook/smbdotconf/base/adsserver.xml
deleted file mode 100644
index 4dd2a4b6351..00000000000
--- a/docs/docbook/smbdotconf/base/adsserver.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<samba:parameter name="ads server"
- context="G"
- basic="1" advanced="1" wizard="1" developer="1"
- xmlns:samba="http://samba.org/common">
-<listitem>
- <para>If this option is specified, samba does not try to figure out what
- ads server to use itself, but uses the specified ads server. Either one
- DNS name or IP address can be used.</para>
-
- <para>Default: <command moreinfo="none">ads server = </command></para>
-
- <para>Example: <command moreinfo="none">ads server = 192.168.1.2</command></para>
-</listitem>
-
-</samba:parameter>
diff --git a/docs/docbook/smbdotconf/base/bindinterfacesonly.xml b/docs/docbook/smbdotconf/base/bindinterfacesonly.xml
deleted file mode 100644
index 3ad9aa4614c..00000000000
--- a/docs/docbook/smbdotconf/base/bindinterfacesonly.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<samba:parameter name="bind interfaces only"
- context="G"
- advanced="1" wizard="1" developer="1"
- xmlns:samba="http://samba.org/common">
-<listitem>
- <para>This global parameter allows the Samba admin
- to limit what interfaces on a machine will serve SMB requests. It
- affects file service <citerefentry><refentrytitle>smbd</refentrytitle>
- <manvolnum>8</manvolnum></citerefentry> and name service <citerefentry><refentrytitle>nmbd</refentrytitle>
- <manvolnum>8</manvolnum></citerefentry> in a slightly different ways.</para>
-
- <para>For name service it causes <command moreinfo="none">nmbd</command> to bind
- to ports 137 and 138 on the interfaces listed in
- the <link linkend="INTERFACES">interfaces</link> parameter. <command moreinfo="none">nmbd</command> also
- binds to the &quot;all addresses&quot; interface (0.0.0.0)
- on ports 137 and 138 for the purposes of reading broadcast messages.
- If this option is not set then <command moreinfo="none">nmbd</command> will service
- name requests on all of these sockets. If <parameter moreinfo="none">bind interfaces
- only</parameter> is set then <command moreinfo="none">nmbd</command> will check the
- source address of any packets coming in on the broadcast sockets
- and discard any that don't match the broadcast addresses of the
- interfaces in the <parameter moreinfo="none">interfaces</parameter> parameter list.
- As unicast packets are received on the other sockets it allows
- <command moreinfo="none">nmbd</command> to refuse to serve names to machines that
- send packets that arrive through any interfaces not listed in the
- <parameter moreinfo="none">interfaces</parameter> list. IP Source address spoofing
- does defeat this simple check, however, so it must not be used
- seriously as a security feature for <command moreinfo="none">nmbd</command>.</para>
-
- <para>For file service it causes <citerefentry><refentrytitle>smbd</refentrytitle>
- <manvolnum>8</manvolnum></citerefentry> to bind only to the interface list
- given in the <link linkend="INTERFACES">interfaces</link> parameter. This
- restricts the networks that <command moreinfo="none">smbd</command> will serve
- to packets coming in those interfaces. Note that you should not use this parameter
- for machines that are serving PPP or other intermittent or non-broadcast network
- interfaces as it will not cope with non-permanent interfaces.</para>
-
- <para>If <parameter moreinfo="none">bind interfaces only</parameter> is set then
- unless the network address <emphasis>127.0.0.1</emphasis> is added
- to the <parameter moreinfo="none">interfaces</parameter> parameter
- list <citerefentry><refentrytitle>smbpasswd</refentrytitle>
- <manvolnum>8</manvolnum></citerefentry> and <citerefentry><refentrytitle>swat</refentrytitle>
- <manvolnum>8</manvolnum></citerefentry> may not work as expected due
- to the reasons covered below.</para>
-
- <para>To change a users SMB password, the <command moreinfo="none">smbpasswd</command>
- by default connects to the <emphasis>localhost - 127.0.0.1</emphasis>
- address as an SMB client to issue the password change request. If
- <parameter moreinfo="none">bind interfaces only</parameter> is set then unless the
- network address <emphasis>127.0.0.1</emphasis> is added to the
- <parameter moreinfo="none">interfaces</parameter> parameter list then <command moreinfo="none">
- smbpasswd</command> will fail to connect in it's default mode.
- <command moreinfo="none">smbpasswd</command> can be forced to use the primary IP interface
- of the local host by using its <citerefentry><refentrytitle>smbpasswd</refentrytitle>
- <manvolnum>8</manvolnum></citerefentry> <parameter moreinfo="none">-r <replaceable>remote machine</replaceable></parameter>
- parameter, with <replaceable>remote machine</replaceable> set
- to the IP name of the primary interface of the local host.</para>
-
- <para>The <command moreinfo="none">swat</command> status page tries to connect with
- <command moreinfo="none">smbd</command> and <command moreinfo="none">nmbd</command> at the address
- <emphasis>127.0.0.1</emphasis> to determine if they are running.
- Not adding <emphasis>127.0.0.1</emphasis> will cause <command moreinfo="none">
- smbd</command> and <command moreinfo="none">nmbd</command> to always show
- &quot;not running&quot; even if they really are. This can prevent <command moreinfo="none">
- swat</command> from starting/stopping/restarting <command moreinfo="none">smbd</command>
- and <command moreinfo="none">nmbd</command>.</para>
-
- <para>Default: <command moreinfo="none">bind interfaces only = no</command></para>
-
-</listitem>
-</samba:parameter>
diff --git a/docs/docbook/smbdotconf/base/comment.xml b/docs/docbook/smbdotconf/base/comment.xml
deleted file mode 100644
index f08d06ef255..00000000000
--- a/docs/docbook/smbdotconf/base/comment.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<samba:parameter name="comment"
- context="S"
- basic="1" advanced="1" share="1" print="1" developer="1"
- xmlns:samba="http://samba.org/common">
-<listitem>
- <para>This is a text field that is seen next to a share
- when a client does a queries the server, either via the network
- neighborhood or via <command moreinfo="none">net view</command> to list what shares
- are available.</para>
-
- <para>If you want to set the string that is displayed next to the
- machine name then see the <link linkend="SERVERSTRING"><parameter moreinfo="none">
- server string</parameter></link> parameter.</para>
-
- <para>Default: <emphasis>No comment string</emphasis></para>
- <para>Example: <command moreinfo="none">comment = Fred's Files</command></para>
-</listitem>
-</samba:parameter>
diff --git a/docs/docbook/smbdotconf/base/directory.xml b/docs/docbook/smbdotconf/base/directory.xml
deleted file mode 100644
index f912c39c8c5..00000000000
--- a/docs/docbook/smbdotconf/base/directory.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<samba:parameter name="directory"
- context="S"
- hide="1"
- xmlns:samba="http://samba.org/common">
-
-<listitem>
- <para>Synonym for <link linkend="PATH"><parameter moreinfo="none">path</parameter></link>.</para>
-</listitem>
-</samba:parameter>
diff --git a/docs/docbook/smbdotconf/base/displaycharset.xml b/docs/docbook/smbdotconf/base/displaycharset.xml
deleted file mode 100644
index e02842ab48a..00000000000
--- a/docs/docbook/smbdotconf/base/displaycharset.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<samba:parameter name="display charset"
- context="G"
- advanced="1" developer="1"
- xmlns:samba="http://samba.org/common">
-<listitem>
- <para>Specifies the charset that samba will use
- to print messages to stdout and stderr and SWAT will use.
- Should generally be the same as the <command moreinfo="none">unix charset</command>.
- </para>
-
- <para>Default: <command moreinfo="none">display charset = ASCII</command></para>
-
- <para>Example: <command moreinfo="none">display charset = UTF8</command></para>
-
-</listitem>
-</samba:parameter>
diff --git a/docs/docbook/smbdotconf/base/doscharset.xml b/docs/docbook/smbdotconf/base/doscharset.xml
deleted file mode 100644
index 5fc718dcaa3..00000000000
--- a/docs/docbook/smbdotconf/base/doscharset.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<samba:parameter name="dos charset"
- context="G"
- advanced="1" developer="1"
- xmlns:samba="http://samba.org/common">
-<listitem>
- <para>DOS SMB clients assume the server has
- the same charset as they do. This option specifies which
- charset Samba should talk to DOS clients.
- </para>
-
- <para>The default depends on which charsets you have installed.
- Samba tries to use charset 850 but falls back to ASCII in
- case it is not available. Run <citerefentry><refentrytitle>testparm</refentrytitle>
- <manvolnum>1</manvolnum></citerefentry> to check the default on your system.</para>
-</listitem>
-</samba:parameter>
diff --git a/docs/docbook/smbdotconf/base/interfaces.xml b/docs/docbook/smbdotconf/base/interfaces.xml
deleted file mode 100644
index 3fa346e206a..00000000000
--- a/docs/docbook/smbdotconf/base/interfaces.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<samba:parameter name="interfaces"
- context="G"
- basic="1" advanced="1" wizard="1" developer="1"
- xmlns:samba="http://samba.org/common">
-<listitem>
- <para>This option allows you to override the default
- network interfaces list that Samba will use for browsing, name
- registration and other NBT traffic. By default Samba will query
- the kernel for the list of all active interfaces and use any
- interfaces except 127.0.0.1 that are broadcast capable.</para>
-
- <para>The option takes a list of interface strings. Each string
- can be in any of the following forms:</para>
-
- <itemizedlist>
- <listitem><para>a network interface name (such as eth0).
- This may include shell-like wildcards so eth* will match
- any interface starting with the substring &quot;eth&quot;</para></listitem>
-
- <listitem><para>an IP address. In this case the netmask is
- determined from the list of interfaces obtained from the
- kernel</para></listitem>
-
- <listitem><para>an IP/mask pair. </para></listitem>
-
- <listitem><para>a broadcast/mask pair.</para></listitem>
- </itemizedlist>
-
- <para>The &quot;mask&quot; parameters can either be a bit length (such
- as 24 for a C class network) or a full netmask in dotted
- decimal form.</para>
-
- <para>The &quot;IP&quot; parameters above can either be a full dotted
- decimal IP address or a hostname which will be looked up via
- the OS's normal hostname resolution mechanisms.</para>
-
- <para>For example, the following line:</para>
-
- <para><command moreinfo="none">interfaces = eth0 192.168.2.10/24 192.168.3.10/255.255.255.0</command></para>
-
- <para>would configure three network interfaces corresponding
- to the eth0 device and IP addresses 192.168.2.10 and 192.168.3.10.
- The netmasks of the latter two interfaces would be set to 255.255.255.0.</para>
-
- <para>See also <link linkend="BINDINTERFACESONLY"><parameter moreinfo="none">bind
- interfaces only</parameter></link>.</para>
-
- <para>Default: <emphasis>all active interfaces except 127.0.0.1
- that are broadcast capable</emphasis></para>
-</listitem>
-</samba:parameter>
diff --git a/docs/docbook/smbdotconf/base/netbiosaliases.xml b/docs/docbook/smbdotconf/base/netbiosaliases.xml
deleted file mode 100644
index a62fb8f7d68..00000000000
--- a/docs/docbook/smbdotconf/base/netbiosaliases.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<samba:parameter name="netbios aliases"
- context="G"
- advanced="1" wizard="1" developer="1"
- xmlns:samba="http://samba.org/common">
-<listitem>
- <para>This is a list of NetBIOS names that <ulink url="nmbd.8.html">nmbd(8)</ulink> will
- advertise as additional names by which the Samba server is known. This allows one machine
- to appear in browse lists under multiple names. If a machine is acting as a browse server
- or logon server none of these names will be advertised as either browse server or logon
- servers, only the primary name of the machine will be advertised with these capabilities.
- </para>
-
- <para>See also <link linkend="NETBIOSNAME"><parameter moreinfo="none">netbios
- name</parameter></link>.</para>
-
- <para>Default: <emphasis>empty string (no additional names)</emphasis></para>
-
- <para>Example: <command moreinfo="none">netbios aliases = TEST TEST1 TEST2</command></para>
-</listitem>
-</samba:parameter>
diff --git a/docs/docbook/smbdotconf/base/netbiosname.xml b/docs/docbook/smbdotconf/base/netbiosname.xml
deleted file mode 100644
index 287a8f9f9f3..00000000000
--- a/docs/docbook/smbdotconf/base/netbiosname.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<samba:parameter name="netbios name"
- context="G"
- basic="1" advanced="1" wizard="1" developer="1"
- xmlns:samba="http://samba.org/common">
-<listitem>
- <para>This sets the NetBIOS name by which a Samba
- server is known. By default it is the same as the first component
- of the host's DNS name. If a machine is a browse server or
- logon server this name (or the first component
- of the hosts DNS name) will be the name that these services are
- advertised under.</para>
-
- <para>See also <link linkend="NETBIOSALIASES"><parameter moreinfo="none">netbios
- aliases</parameter></link>.</para>
-
- <para>Default: <emphasis>machine DNS name</emphasis></para>
-
- <para>Example: <command moreinfo="none">netbios name = MYNAME</command></para>
-</listitem>
-</samba:parameter>
diff --git a/docs/docbook/smbdotconf/base/netbiosscope.xml b/docs/docbook/smbdotconf/base/netbiosscope.xml
deleted file mode 100644
index 8c5866bc321..00000000000
--- a/docs/docbook/smbdotconf/base/netbiosscope.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<samba:parameter name="netbios scope"
- context="G"
- advanced="1" developer="1"
- xmlns:samba="http://samba.org/common">
-<listitem>
- <para>This sets the NetBIOS scope that Samba will
- operate under. This should not be set unless every machine
- on your LAN also sets this value.</para>
-</listitem>
-</samba:parameter>
diff --git a/docs/docbook/smbdotconf/base/path.xml b/docs/docbook/smbdotconf/base/path.xml
deleted file mode 100644
index 9f0a7cd9762..00000000000
--- a/docs/docbook/smbdotconf/base/path.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<samba:parameter name="path"
- context="S"
- basic="1" advanced="1" share="1" print="1" developer="1"
- xmlns:samba="http://samba.org/common">
-<listitem>
- <para>This parameter specifies a directory to which
- the user of the service is to be given access. In the case of
- printable services, this is where print data will spool prior to
- being submitted to the host for printing.</para>
-
- <para>For a printable service offering guest access, the service
- should be readonly and the path should be world-writeable and
- have the sticky bit set. This is not mandatory of course, but
- you probably won't get the results you expect if you do
- otherwise.</para>
-
- <para>Any occurrences of <parameter moreinfo="none">%u</parameter> in the path
- will be replaced with the UNIX username that the client is using
- on this connection. Any occurrences of <parameter moreinfo="none">%m</parameter>
- will be replaced by the NetBIOS name of the machine they are
- connecting from. These replacements are very useful for setting
- up pseudo home directories for users.</para>
-
- <para>Note that this path will be based on <link linkend="ROOTDIR">
- <parameter moreinfo="none">root dir</parameter></link> if one was specified.</para>
-
- <para>Default: <emphasis>none</emphasis></para>
-
- <para>Example: <command moreinfo="none">path = /home/fred</command></para>
-</listitem>
-</samba:parameter>
diff --git a/docs/docbook/smbdotconf/base/realm.xml b/docs/docbook/smbdotconf/base/realm.xml
deleted file mode 100644
index c0b1d1aad68..00000000000
--- a/docs/docbook/smbdotconf/base/realm.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<samba:parameter name="realm"
- context="G"
- basic="1" advanced="1" wizard="1" developer="1"
- xmlns:samba="http://samba.org/common">
-<listitem>
- <para>This option specifies the kerberos realm to use. The realm is
- used as the ADS equivalent of the NT4 <command moreinfo="none">domain</command>. It
- is usually set to the DNS name of the kerberos server.
- </para>
-
- <para>Default: <command moreinfo="none">realm = </command></para>
-
- <para>Example: <command moreinfo="none">realm = mysambabox.mycompany.com</command></para>
-</listitem>
-</samba:parameter>
diff --git a/docs/docbook/smbdotconf/base/serverstring.xml b/docs/docbook/smbdotconf/base/serverstring.xml
deleted file mode 100644
index 5935dd80ddd..00000000000
--- a/docs/docbook/smbdotconf/base/serverstring.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<samba:parameter name="server string"
- context="G"
- basic="1" advanced="1" developer="1"
- xmlns:samba="http://samba.org/common">
-<listitem>
- <para>This controls what string will show up in the printer comment box in print
- manager and next to the IPC connection in <command moreinfo="none">net view</command>. It
- can be any string that you wish to show to your users.</para>
-
- <para>It also sets what will appear in browse lists next
- to the machine name.</para>
-
- <para>A <parameter moreinfo="none">%v</parameter> will be replaced with the Samba
- version number.</para>
-
- <para>A <parameter moreinfo="none">%h</parameter> will be replaced with the
- hostname.</para>
-
- <para>Default: <command moreinfo="none">server string = Samba %v</command></para>
-
- <para>Example: <command moreinfo="none">server string = University of GNUs Samba
- Server</command></para>
-</listitem>
-</samba:parameter>
diff --git a/docs/docbook/smbdotconf/base/unixcharset.xml b/docs/docbook/smbdotconf/base/unixcharset.xml
deleted file mode 100644
index f003c097aa6..00000000000
--- a/docs/docbook/smbdotconf/base/unixcharset.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<samba:parameter name="unix charset"
- context="G"
- advanced="1" developer="1"
- xmlns:samba="http://samba.org/common">
-<listitem>
- <para>Specifies the charset the unix machine
- Samba runs on uses. Samba needs to know this in order to be able to
- convert text to the charsets other SMB clients use.
- </para>
-
- <para>Default: <command moreinfo="none">unix charset = UTF8</command></para>
-
- <para>Example: <command moreinfo="none">unix charset = ASCII</command></para>
-</listitem>
-</samba:parameter>
diff --git a/docs/docbook/smbdotconf/base/workgroup.xml b/docs/docbook/smbdotconf/base/workgroup.xml
deleted file mode 100644
index 65300bca589..00000000000
--- a/docs/docbook/smbdotconf/base/workgroup.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<samba:parameter name="workgroup"
- context="G"
- basic="1" advanced="1" wizard="1" developer="1"
- xmlns:samba="http://samba.org/common">
-<listitem>
- <para>This controls what workgroup your server will
- appear to be in when queried by clients. Note that this parameter
- also controls the Domain name used with
- the <link linkend="SECURITYEQUALSDOMAIN"><command moreinfo="none">security = domain</command></link>
- setting.</para>
-
- <para>Default: <emphasis>set at compile time to WORKGROUP</emphasis></para>
-
- <para>Example: <command moreinfo="none">workgroup = MYGROUP</command></para>
-</listitem>
-</samba:parameter>
diff --git a/docs/docbook/smbdotconf/generate-file-list.sh b/docs/docbook/smbdotconf/generate-file-list.sh
deleted file mode 100755
index 3495f50c432..00000000000
--- a/docs/docbook/smbdotconf/generate-file-list.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-echo "<variablelist>"
-find . -type f -name '*.xml' -mindepth 2 | sort -t/ -k3 |
- while read ; do
- echo "<xi:include href='$REPLY' parse='xml' xmlns:xi='http://www.w3.org/2001/XInclude'/>"
- done
-
-echo "</variablelist>"
diff --git a/docs/docbook/smbdotconf/smbconf.dtd b/docs/docbook/smbdotconf/smbconf.dtd
deleted file mode 100644
index 591c9b2738a..00000000000
--- a/docs/docbook/smbdotconf/smbconf.dtd
+++ /dev/null
@@ -1,10 +0,0 @@
-<!ELEMENT parameter (#PCDATA) >
-<!ATTLIST parameter name CDATA #REQUIRED >
-<!ATTLIST parameter context CDATA #REQUIRED >
-<!ATTLIST parameter basic CDATA #REQUIRED >
-<!ATTLIST parameter wizard CDATA #REQUIRED >
-<!ATTLIST parameter advanced CDATA #REQUIRED >
-<!ATTLIST parameter share CDATA #REQUIRED >
-<!ATTLIST parameter print CDATA #REQUIRED >
-<!ATTLIST parameter developer CDATA #REQUIRED >
-<!ATTLIST parameter hide CDATA #REQUIRED >
diff --git a/docs/docbook/smbdotconf/split-original-smb.conf.xsl b/docs/docbook/smbdotconf/split-original-smb.conf.xsl
deleted file mode 100644
index 7a6a2b920a1..00000000000
--- a/docs/docbook/smbdotconf/split-original-smb.conf.xsl
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version='1.0'?>
-<!-- vim:set sts=2 shiftwidth=2 syntax=xml: -->
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:exsl="http://exslt.org/common"
- xmlns:samba="http://samba.org/common"
- version="1.1"
- extension-element-prefixes="exsl">
-
-<xsl:output method="xml"/>
-
-<xsl:param name="output.dir.name" select="'test/'"/>
-
-<!-- This is needed to copy content unchanged -->
-<xsl:template match="@*|node()">
- <xsl:copy>
- <xsl:apply-templates select="@*|node()"/>
- </xsl:copy>
-</xsl:template>
-
-<!-- Parse all varlistentries and extract those of them which are descriptions of smb.conf
- parameters. We determine them by existence of <anchor> element inside <term> element.
- If <anchor> is there, then its 'id' attribute is translated to lower case and is used
- as basis for file name for that parameter.
--->
-<xsl:template match="varlistentry">
- <xsl:variable name="output.dir.name" select="$output.dir.name"/>
- <!-- Extract anchor's 'id' and translate it to lower case -->
- <xsl:variable name="fname">
- <xsl:value-of select="translate(string(term/anchor/@id),
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
- </xsl:variable>
- <!-- reconstruct varlistentry - not all of them will go into separate files
- and also we must repair the main varlistentry itself.
- -->
- <xsl:variable name="content">
- <xsl:apply-templates/>
- </xsl:variable>
- <!-- Now put varlistentry into separate file _if_ it has anchor associated with it -->
- <xsl:choose>
- <xsl:when test="$fname != ''">
- <!-- full file name -->
- <xsl:variable name="filename"><xsl:value-of select="$output.dir.name"/><xsl:value-of select="$fname"/>.xml</xsl:variable>
- <!-- Debug message for an operator, just to show progress of processing :) -->
- <xsl:message>
- <xsl:text>Writing </xsl:text>
- <xsl:value-of select="$filename"/>
- <xsl:text> for </xsl:text>
- <xsl:value-of select="name(.)"/>
- <xsl:if test="term/anchor/@id">
- <xsl:text>(</xsl:text>
- <xsl:value-of select="term/anchor/@id"/>
- <xsl:text>)</xsl:text>
- </xsl:if>
- </xsl:message>
- <!-- Write finally varlistentry to a separate file -->
- <exsl:document href="{$filename}"
- method="xml"
- encoding="UTF-8"
- indent="yes"
- omit-xml-declaration="yes">
- <xsl:element name="samba:parameter">
- <xsl:copy-of select="$content"/>
- </xsl:element>
- </exsl:document>
- <xsl:text disable-output-escaping="yes">&amp;smb.</xsl:text>
- <xsl:value-of select="$fname"/>
- <xsl:text>;</xsl:text>
- </xsl:when>
- <!-- this was a varlistentry w/o anchor associated, just dump it to the main document -->
- <xsl:otherwise>
- <xsl:element name="varlistentry">
- <xsl:copy-of select="$content"/>
- </xsl:element>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-</xsl:stylesheet>
diff --git a/source/client/mount.cifs.c b/source/client/mount.cifs.c
deleted file mode 100755
index 7167859d7b2..00000000000
--- a/source/client/mount.cifs.c
+++ /dev/null
@@ -1,557 +0,0 @@
-#define _GNU_SOURCE
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <pwd.h>
-#include <sys/types.h>
-#include <sys/mount.h>
-#include <sys/stat.h>
-#include <sys/utsname.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <getopt.h>
-#include <errno.h>
-#include <netdb.h>
-#include <string.h>
-#include <mntent.h>
-
-#define MOUNT_CIFS_VERSION "1"
-
-extern char *getusername(void);
-
-char * thisprogram;
-int verboseflag = 0;
-static int got_password = 0;
-static int got_user = 0;
-static int got_domain = 0;
-static int got_ip = 0;
-static int got_unc = 0;
-static int got_uid = 0;
-static int got_gid = 0;
-static char * user_name = NULL;
-char * mountpassword = NULL;
-
-
-void mount_cifs_usage()
-{
- printf("\nUsage: %s remotetarget dir\n", thisprogram);
- printf("\nMount the remotetarget, specified as either a UNC name or ");
- printf(" CIFS URL, to the local directory, dir.\n");
-
- exit(1);
-}
-
-/* caller frees username if necessary */
-char * getusername() {
- char *username = NULL;
- struct passwd *password = getpwuid(getuid());
-
- if (password) {
- username = password->pw_name;
- }
- return username;
-}
-
-char * parse_cifs_url(unc_name)
-{
- printf("\ncifs url %s\n",unc_name);
-}
-
-int parse_options(char * options)
-{
- char * data;
- char * value = 0;
-
- if (!options)
- return 1;
-
- while ((data = strsep(&options, ",")) != NULL) {
- if (!*data)
- continue;
- if ((value = strchr(data, '=')) != NULL) {
- *value++ = '\0';
- }
- if (strncmp(data, "user", 4) == 0) {
- if (!value || !*value) {
- printf("invalid or missing username\n");
- return 1; /* needs_arg; */
- }
- if (strnlen(value, 260) < 260) {
- got_user=1;
- /* BB add check for format user%pass */
- /* if(strchr(username%passw) got_password = 1) */
- } else {
- printf("username too long\n");
- return 1;
- }
- } else if (strncmp(data, "pass", 4) == 0) {
- if (!value || !*value) {
- if(got_password) {
- printf("password specified twice, ignoring second\n");
- } else
- got_password = 1;
- } else if (strnlen(value, 17) < 17) {
- got_password = 1;
- } else {
- printf("password too long\n");
- return 1;
- }
- } else if (strncmp(data, "ip", 2) == 0) {
- if (!value || !*value) {
- printf("target ip address argument missing");
- } else if (strnlen(value, 35) < 35) {
- got_ip = 1;
- } else {
- printf("ip address too long\n");
- return 1;
- }
- } else if ((strncmp(data, "unc", 3) == 0)
- || (strncmp(data, "target", 6) == 0)
- || (strncmp(data, "path", 4) == 0)) {
- if (!value || !*value) {
- printf("invalid path to network resource\n");
- return 1; /* needs_arg; */
- } else if(strnlen(value,5) < 5) {
- printf("UNC name too short");
- }
-
- if (strnlen(value, 300) < 300) {
- got_unc = 1;
- if (strncmp(value, "//", 2) == 0) {
- if(got_unc)
- printf("unc name specified twice, ignoring second\n");
- else
- got_unc = 1;
- } else if (strncmp(value, "\\\\", 2) != 0) {
- printf("UNC Path does not begin with // or \\\\ \n");
- return 1;
- } else {
- if(got_unc)
- printf("unc name specified twice, ignoring second\n");
- else
- got_unc = 1;
- }
- } else {
- printf("CIFS: UNC name too long\n");
- return 1;
- }
- } else if ((strncmp(data, "domain", 3) == 0)
- || (strncmp(data, "workgroup", 5) == 0)) {
- if (!value || !*value) {
- printf("CIFS: invalid domain name\n");
- return 1; /* needs_arg; */
- }
- if (strnlen(value, 65) < 65) {
- got_domain = 1;
- } else {
- printf("domain name too long\n");
- return 1;
- }
- } else if (strncmp(data, "uid", 3) == 0) {
- if (value && *value) {
- got_uid = 1;
- }
- } else if (strncmp(data, "gid", 3) == 0) {
- if (value && *value) {
- got_gid = 1;
- }
- } /* else if (strnicmp(data, "file_mode", 4) == 0) {
- if (value && *value) {
- vol->file_mode =
- simple_strtoul(value, &value, 0);
- }
- } else if (strnicmp(data, "dir_mode", 3) == 0) {
- if (value && *value) {
- vol->dir_mode =
- simple_strtoul(value, &value, 0);
- }
- } else if (strnicmp(data, "port", 4) == 0) {
- if (value && *value) {
- vol->port =
- simple_strtoul(value, &value, 0);
- }
- } else if (strnicmp(data, "rsize", 5) == 0) {
- if (value && *value) {
- vol->rsize =
- simple_strtoul(value, &value, 0);
- }
- } else if (strnicmp(data, "wsize", 5) == 0) {
- if (value && *value) {
- vol->wsize =
- simple_strtoul(value, &value, 0);
- }
- } else if (strnicmp(data, "version", 3) == 0) {
-
- } else if (strnicmp(data, "rw", 2) == 0) {
-
- } else
- printf("CIFS: Unknown mount option %s\n",data); */
- }
- return 0;
-}
-
-/* Note that caller frees the returned buffer if necessary */
-char * parse_server(char * unc_name)
-{
- int length = strnlen(unc_name,1024);
- char * share;
- char * ipaddress_string = NULL;
- struct hostent * host_entry;
- struct in_addr server_ipaddr;
- int rc,j;
- char temp[64];
-
- if(length > 1023) {
- printf("mount error: UNC name too long");
- return 0;
- }
- if (strncasecmp("cifs://",unc_name,7) == 0)
- return parse_cifs_url(unc_name+7);
- if (strncasecmp("smb://",unc_name,6) == 0) {
- return parse_cifs_url(unc_name+6);
- }
-
- if(length < 3) {
- /* BB add code to find DFS root here */
- printf("\nMounting the DFS root for domain not implemented yet");
- return 0;
- } else {
- /* BB add support for \\\\ not just // */
- if(strncmp(unc_name,"//",2) && strncmp(unc_name,"\\\\",2)) {
- printf("mount error: improperly formatted UNC name.");
- printf(" %s does not begin with \\\\ or //\n",unc_name);
- return 0;
- } else {
- unc_name[0] = '\\';
- unc_name[1] = '\\';
- unc_name += 2;
- if ((share = strchr(unc_name, '/')) ||
- (share = strchr(unc_name,'\\'))) {
- *share = 0; /* temporarily terminate the string */
- share += 1;
- host_entry = gethostbyname(unc_name);
- *(share - 1) = '\\'; /* put the slash back */
-/* rc = getipnodebyname(unc_name, AF_INET, AT_ADDRCONFIG ,&rc);*/
- if(host_entry == NULL) {
- printf("mount error: could not find target server. TCP name %s not found ", unc_name);
- printf(" rc = %d\n",rc);
- return 0;
- }
- else {
- /* BB should we pass an alternate version of the share name as Unicode */
- /* BB what about ipv6? BB */
- /* BB add retries with alternate servers in list */
-
- memcpy(&server_ipaddr.s_addr, host_entry->h_addr, 4);
-
- ipaddress_string = inet_ntoa(server_ipaddr);
- if(ipaddress_string == NULL) {
- printf("mount error: could not get valid ip address for target server\n");
- return 0;
- }
- return ipaddress_string;
- }
- } else {
- /* BB add code to find DFS root (send null path on get DFS Referral to specified server here */
- printf("Mounting the DFS root for a particular server not implemented yet\n");
- return 0;
- }
- }
- }
-}
-
-static struct option longopts[] = {
- { "all", 0, 0, 'a' },
- { "help", 0, 0, 'h' },
- { "read-only", 0, 0, 'r' },
- { "ro", 0, 0, 'r' },
- { "verbose", 0, 0, 'v' },
- { "version", 0, 0, 'V' },
- { "read-write", 0, 0, 'w' },
- { "rw", 0, 0, 'w' },
- { "options", 1, 0, 'o' },
- { "types", 1, 0, 't' },
- { "replace", 0, 0, 129 },
- { "after", 0, 0, 130 },
- { "before", 0, 0, 131 },
- { "over", 0, 0, 132 },
- { "move", 0, 0, 133 },
- { "rsize",1, 0, 136 },
- { "wsize",1, 0, 137 },
- { "uid", 1, 0, 138},
- { "gid", 1, 0, 139},
- { "uuid",1,0,'U' },
- { "user",1,0,140},
- { "username",1,0,140},
- { "dom",1,0,141},
- { "domain",1,0,141},
- { "password",1,0,142},
- { NULL, 0, 0, 0 }
-};
-
-int main(int argc, char ** argv)
-{
- int c;
- int flags = MS_MANDLOCK | MS_MGC_VAL;
- char * orgoptions = NULL;
- char * share_name = NULL;
- char * domain_name = NULL;
- char * ipaddr = NULL;
- char * uuid = NULL;
- char * mountpoint;
- char * options;
- int rc,i;
- int rsize = 0;
- int wsize = 0;
- int nomtab = 0;
- int uid = 0;
- int gid = 0;
- int optlen = 0;
- struct stat statbuf;
- struct utsname sysinfo;
- struct mntent mountent;
- FILE * pmntfile;
-
- /* setlocale(LC_ALL, "");
- bindtextdomain(PACKAGE, LOCALEDIR);
- textdomain(PACKAGE); */
-
- if(argc && argv) {
- thisprogram = argv[0];
- }
- if(thisprogram == NULL)
- thisprogram = "mount.cifs";
-
- uname(&sysinfo);
- /* BB add workstation name and domain and pass down */
-/*#ifdef _GNU_SOURCE
- printf(" node: %s machine: %s\n", sysinfo.nodename,sysinfo.machine);
-#endif*/
- if(argc < 3)
- mount_cifs_usage();
- share_name = argv[1];
- mountpoint = argv[2];
- /* add sharename in opts string as unc= parm */
-
- while ((c = getopt_long (argc, argv, "afFhilL:no:O:rsU:vVwt:",
- longopts, NULL)) != -1) {
- switch (c) {
-/* case 'a':
- ++mount_all;
- break;
- case 'f':
- ++fake;
- break;
- case 'F':
- ++optfork;
- break; */
- case 'h': /* help */
- mount_cifs_usage ();
- break;
-/* case 'i':
- external_allowed = 0;
- break;
- case 'l':
- list_with_volumelabel = 1;
- break;
- case 'L':
- volumelabel = optarg;
- break; */
- case 'n':
- ++nomtab;
- break;
- case 'o':
- if (orgoptions) {
- orgoptions = strcat(orgoptions, ",");
- orgoptions = strcat(orgoptions,optarg);
- } else
- orgoptions = strdup(optarg);
- break;
-
-/* case 'O':
- if (test_opts)
- test_opts = xstrconcat3(test_opts, ",", optarg);
- else
- test_opts = xstrdup(optarg);
- break;*/
- case 'r': /* mount readonly */
- flags |= MS_RDONLY;;
- break;
- case 'U':
- uuid = optarg;
- break;
- case 'v':
- ++verboseflag;
- break;
-/* case 'V':
- printf ("mount: %s\n", version);
- exit (0);*/
- case 'w':
- flags &= ~MS_RDONLY;;
- break;
-/* case 0:
- break;
-
- case 128:
- mounttype = MS_BIND;
- break;
- case 129:
- mounttype = MS_REPLACE;
- break;
- case 130:
- mounttype = MS_AFTER;
- break;
- case 131:
- mounttype = MS_BEFORE;
- break;
- case 132:
- mounttype = MS_OVER;
- break;
- case 133:
- mounttype = MS_MOVE;
- break;
- case 135:
- mounttype = (MS_BIND | MS_REC);
- break; */
- case 136:
- rsize = atoi(optarg) ;
- break;
- case 137:
- wsize = atoi(optarg);
- break;
- case 138:
- uid = atoi(optarg);
- break;
- case 139:
- gid = atoi(optarg);
- break;
- case 140:
- got_user = 1;
- user_name = optarg;
- break;
- case 141:
- domain_name = optarg;
- break;
- case 142:
- got_password = 1;
- mountpassword = optarg;
- break;
- case '?':
- default:
- mount_cifs_usage ();
- }
- }
-
- /* canonicalize the path in argv[1]? */
-
- if(stat (mountpoint, &statbuf)) {
- printf("mount error: mount point %s does not exist\n",mountpoint);
- return -1;
- }
- if (S_ISDIR(statbuf.st_mode) == 0) {
- printf("mount error: mount point %s is not a directory\n",mountpoint);
- return -1;
- }
-
- if(geteuid()) {
- printf("mount error: permission denied, not superuser and cifs.mount not installed SUID\n");
- return -1;
- }
-
- ipaddr = parse_server(share_name);
-/* if(share_name == NULL)
- return 1; */
- if (parse_options(strdup(orgoptions)))
- return 1;
-
- if(got_user == 0)
- user_name = getusername();
-
-/* check username for user%password format */
-
- if(got_password == 0) {
- if (getenv("PASSWD")) {
- mountpassword = malloc(33);
- if(mountpassword) {
- strncpy(mountpassword,getenv("PASSWD"),32);
- got_password = 1;
- }
-/* } else if (getenv("PASSWD_FD") || getenv("PASSWD_FILE")) {
- get_password_file();
- got_password = 1;*/ /* BB add missing function */
- } else {
- mountpassword = getpass("Password: "); /* BB obsolete */
- got_password = 1;
- }
- }
- /* FIXME launch daemon (handles dfs name resolution and credential change)
- remember to clear parms and overwrite password field before launching */
- if(orgoptions) {
- optlen = strlen(orgoptions);
- } else
- optlen = 0;
- if(share_name)
- optlen += strlen(share_name) + 4;
- if(user_name)
- optlen += strlen(user_name) + 6;
- if(ipaddr)
- optlen += strlen(ipaddr) + 4;
- if(mountpassword)
- optlen += strlen(mountpassword) + 6;
- options = malloc(optlen + 10);
-
- options[0] = 0;
- strncat(options,"unc=",4);
- strcat(options,share_name);
- if(ipaddr) {
- strncat(options,",ip=",4);
- strcat(options,ipaddr);
- }
- if(user_name) {
- strncat(options,",user=",6);
- strcat(options,user_name);
- }
- if(mountpassword) {
- strncat(options,",pass=",6);
- strcat(options,mountpassword);
- }
- strncat(options,",ver=",5);
- strcat(options,MOUNT_CIFS_VERSION);
-
- if(orgoptions) {
- strcat(options,",");
- strcat(options,orgoptions);
- }
- /* printf("\noptions %s \n",options);*/
- if(mount(share_name, mountpoint, "cifs", flags, options)) {
- /* remember to kill daemon on error */
- switch (errno) {
- case 0:
- printf("mount failed but no error number set\n");
- return 0;
- case ENODEV:
- printf("mount error: cifs filesystem not supported by the system\n");
- break;
- default:
- printf("mount error %d = %s",errno,strerror(errno));
- }
- printf("Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)\n");
- return -1;
- } else {
- pmntfile = setmntent(MOUNTED, "a+");
- if(pmntfile) {
- mountent.mnt_fsname = share_name;
- mountent.mnt_dir = mountpoint;
- mountent.mnt_type = "cifs";
- mountent.mnt_opts = "";
- mountent.mnt_freq = 0;
- mountent.mnt_passno = 0;
- rc = addmntent(pmntfile,&mountent);
- endmntent(pmntfile);
- } else {
- printf("could not update mount table\n");
- }
- }
- return 0;
-}
-
diff --git a/source/include/popt_common.h b/source/include/popt_common.h
deleted file mode 100644
index 57850bf6826..00000000000
--- a/source/include/popt_common.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Common popt arguments
- Copyright (C) Jelmer Vernooij 2003
-
- 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef _POPT_COMMON_H
-#define _POPT_COMMON_H
-
-/* Common popt structures */
-extern struct poptOption popt_common_samba[];
-extern struct poptOption popt_common_connection[];
-extern struct poptOption popt_common_version[];
-extern struct poptOption popt_common_credentials[];
-
-#ifndef POPT_TABLEEND
-#define POPT_TABLEEND { NULL, '\0', 0, 0, 0, NULL, NULL }
-#endif
-
-#define POPT_COMMON_SAMBA { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_samba, 0, "Common samba options:", NULL },
-#define POPT_COMMON_CONNECTION { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_connection, 0, "Connection options:", NULL },
-#define POPT_COMMON_VERSION { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_version, 0, "Common samba options:", NULL },
-#define POPT_COMMON_CREDENTIALS { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_credentials, 0, "Authentication options:", NULL },
-
-struct user_auth_info {
- pstring username;
- pstring password;
- BOOL got_pass;
- BOOL use_kerberos;
-};
-
-extern struct user_auth_info cmdline_auth_info;
-
-#endif /* _POPT_COMMON_H */
diff --git a/source/libsmb/trustdom_cache.c b/source/libsmb/trustdom_cache.c
deleted file mode 100644
index cddbb2daa61..00000000000
--- a/source/libsmb/trustdom_cache.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- Trusted domain names cache on top of gencache.
-
- Copyright (C) Rafal Szczesniak 2002
-
- 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "includes.h"
-
-#undef DBGC_CLASS
-#define DBGC_CLASS DBGC_ALL /* there's no proper class yet */
-
-#define TDOMKEY_FMT "TDOM/%s"
-
-
-/**
- * @file trustdom_cache.c
- *
- * Implementation of trusted domain names cache useful when
- * samba acts as domain member server. In such case, caching
- * domain names currently trusted gives a performance gain
- * because there's no need to query PDC each time we need
- * list of trusted domains
- **/
-
-
-/**
- * Initialise trustdom name caching system. Call gencache
- * initialisation routine to perform necessary activities.
- *
- * @return true upon successful cache initialisation or
- * false if cache init failed
- **/
-
-BOOL trustdom_cache_enable(void)
-{
- /* Init trustdom cache by calling gencache initialisation */
- if (!gencache_init()) {
- DEBUG(2, ("trustdomcache_enable: Couldn't initialise trustdom cache on top of gencache.\n"));
- return False;
- }
-
- return True;
-}
-
-
-/**
- * Shutdown trustdom name caching system. Calls gencache
- * shutdown function.
- *
- * @return true upon successful cache close or
- * false if it failed
- **/
-
-BOOL trustdom_cache_shutdown(void)
-{
- /* Close trustdom cache by calling gencache shutdown */
- if (!gencache_shutdown()) {
- DEBUG(2, ("trustdomcache_shutdown: Couldn't shutdown trustdom cache on top of gencache.\n"));
- return False;
- }
-
- return True;
-}
-
-
-/**
- * Form up trustdom name key. It is based only
- * on domain name now.
- *
- * @param name trusted domain name
- * @return cache key for use in gencache mechanism
- **/
-
-static char* trustdom_cache_key(const char* name)
-{
- char* keystr;
- asprintf(&keystr, TDOMKEY_FMT, strupper_static(name));
-
- return keystr;
-}
-
-
-/**
- * Store trusted domain in gencache as the domain name (key)
- * and ip address of domain controller (value)
- *
- * @param name trusted domain name
- * @param alt_name alternative trusted domain name (used in ADS domains)
- * @param sid trusted domain's SID
- * @param timeout cache entry expiration time
- * @return true upon successful value storing or
- * false if store attempt failed
- **/
-
-BOOL trustdom_cache_store(char* name, char* alt_name, const DOM_SID *sid,
- time_t timeout)
-{
- char *key, *alt_key;
- fstring sid_string;
-
- /*
- * we use gecache call to avoid annoying debug messages
- * about initialised trustdom
- */
- if (!gencache_init()) return False;
-
- DEBUG(5, ("trustdom_store: storing SID %s of domain %s\n",
- sid_string_static(sid), name));
-
- key = trustdom_cache_key(name);
- alt_key = alt_name ? trustdom_cache_key(alt_name) : NULL;
-
- /* Generate string representation domain SID */
- sid_to_string(sid_string, sid);
-
- /*
- * try to put the names in the cache
- */
- if (alt_key) {
- return (gencache_set(alt_key, sid_string, timeout)
- && gencache_set(key, sid_string, timeout));
- }
-
- return gencache_set(key, sid_string, timeout);
-}
-
-
-/**
- * Fetch trusted domain's dc from the gencache.
- * This routine can also be used to check whether given
- * domain is currently trusted one.
- *
- * @param name trusted domain name
- * @param sid trusted domain's SID to be returned
- * @return true if entry is found or
- * false if has expired/doesn't exist
- **/
-
-BOOL trustdom_cache_fetch(const char* name, DOM_SID* sid)
-{
- char *key, *value;
- time_t timeout;
-
- /* init the cache */
- if (!gencache_init()) return False;
-
- /* exit now if null pointers were passed as they're required further */
- if (!sid) return False;
-
- /* prepare a key and get the value */
- key = trustdom_cache_key(name);
-
- if (!gencache_get(key, &value, &timeout)) {
- DEBUG(5, ("no entry for trusted domain %s found.\n", name));
- return False;
- } else {
- DEBUG(5, ("trusted domain %s found (%s)\n", name, value));
- }
-
- /* convert ip string representation into in_addr structure */
- if(! string_to_sid(sid, value)) {
- sid = NULL;
- return False;
- }
-
- return True;
-}
-
-
-/**
- * Delete single trustdom entry. Look at the
- * gencache_iterate definition.
- *
- **/
-
-static void flush_trustdom_name(const char* key, const char *value, time_t timeout, void* dptr)
-{
- gencache_del(key);
- DEBUG(5, ("Deleting entry %s\n", key));
-}
-
-
-/**
- * Flush all the trusted domains entries from the cache.
- **/
-
-void trustdom_cache_flush(void)
-{
- if (!gencache_init())
- return;
-
- /*
- * iterate through each TDOM cache's entry and flush it
- * by flush_trustdom_name function
- */
- gencache_iterate(flush_trustdom_name, NULL, trustdom_cache_key("*"));
- DEBUG(5, ("Trusted domains cache flushed\n"));
-}
-
diff --git a/source/modules/vfs_fake_perms.c b/source/modules/vfs_fake_perms.c
deleted file mode 100644
index 121a99a4519..00000000000
--- a/source/modules/vfs_fake_perms.c
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * Fake Perms VFS module. Implements passthrough operation of all VFS
- * calls to disk functions, except for file permissions, which are now
- * mode 0700 for the current uid/gid.
- *
- * Copyright (C) Tim Potter, 1999-2000
- * Copyright (C) Alexander Bokovoy, 2002
- * Copyright (C) Andrew Bartlett, 2002
- *
- * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <sys/stat.h>
-#ifdef HAVE_UTIME_H
-#include <utime.h>
-#endif
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#include <errno.h>
-#include <string.h>
-
-#include <includes.h>
-#include <vfs.h>
-
-static struct vfs_ops default_vfs_ops; /* For passthrough operation */
-static struct smb_vfs_handle_struct *fake_perms_handle; /* use fake_perms_handle->data for storing per-instance private data */
-
-static int fake_perms_stat(struct connection_struct *conn, const char *fname, SMB_STRUCT_STAT *sbuf)
-{
- int ret = default_vfs_ops.stat(conn, fname, sbuf);
- if (ret == 0) {
- extern struct current_user current_user;
-
- if (S_ISDIR(sbuf->st_mode)) {
- sbuf->st_mode = S_IFDIR | S_IRWXU;
- } else {
- sbuf->st_mode = S_IRWXU;
- }
- sbuf->st_uid = current_user.uid;
- sbuf->st_gid = current_user.gid;
- }
- return ret;
-}
-
-static int fake_perms_fstat(struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf)
-{
- int ret = default_vfs_ops.fstat(fsp, fd, sbuf);
- if (ret == 0) {
- extern struct current_user current_user;
-
- if (S_ISDIR(sbuf->st_mode)) {
- sbuf->st_mode = S_IFDIR | S_IRWXU;
- } else {
- sbuf->st_mode = S_IRWXU;
- }
- sbuf->st_uid = current_user.uid;
- sbuf->st_gid = current_user.gid;
- }
- return ret;
-}
-
-#if 0
-static size_t fake_perms_fget_nt_acl(struct files_struct *fsp, int fd, struct security_descriptor_info **ppdesc)
-{
- return default_vfs_ops.fget_nt_acl(fsp, fd, ppdesc);
-}
-
-static size_t fake_perms_get_nt_acl(struct files_struct *fsp, const char *name, struct security_descriptor_info **ppdesc)
-{
- return default_vfs_ops.get_nt_acl(fsp, name, ppdesc);
-}
-
-static BOOL fake_perms_fset_nt_acl(struct files_struct *fsp, int fd, uint32 security_info_sent, struct security_descriptor_info *psd)
-{
- return default_vfs_ops.fset_nt_acl(fsp, fd, security_info_sent, psd);
-}
-
-static BOOL fake_perms_set_nt_acl(struct files_struct *fsp, const char *name, uint32 security_info_sent, struct security_descriptor_info *psd)
-{
- return default_vfs_ops.set_nt_acl(fsp, name, security_info_sent, psd);
-}
-
-static BOOL fake_perms_chmod_acl(struct connection_struct *conn, const char *name, mode_t mode)
-{
- return default_vfs_ops.chmod_acl(conn, name, mode);
-}
-
-static BOOL fake_perms_fchmod_acl(struct files_struct *fsp, int fd, mode_t mode)
-{
- return default_vfs_ops.fchmod_acl(fsp, fd, mode);
-}
-
-static int fake_perms_sys_acl_get_entry(struct connection_struct *conn, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p)
-{
- return default_vfs_ops.sys_acl_get_entry(conn, theacl, entry_id, entry_p);
-}
-
-static int fake_perms_sys_acl_get_tag_type(struct connection_struct *conn, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p)
-{
- return default_vfs_ops.sys_acl_get_tag_type(conn, entry_d, tag_type_p);
-}
-
-static int fake_perms_sys_acl_get_permset(struct connection_struct *conn, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p)
-{
- return default_vfs_ops.sys_acl_get_permset(conn, entry_d, permset_p);
-}
-
-static void *fake_perms_sys_acl_get_qualifier(struct connection_struct *conn, SMB_ACL_ENTRY_T entry_d)
-{
- return default_vfs_ops.sys_acl_get_qualifier(conn, entry_d);
-}
-
-static SMB_ACL_T fake_perms_sys_acl_get_file(struct connection_struct *conn, const char *path_p, SMB_ACL_TYPE_T type)
-{
- return default_vfs_ops.sys_acl_get_file(conn, path_p, type);
-}
-
-static SMB_ACL_T fake_perms_sys_acl_get_fd(struct files_struct *fsp, int fd)
-{
- return default_vfs_ops.sys_acl_get_fd(fsp, fd);
-}
-
-static int fake_perms_sys_acl_clear_perms(struct connection_struct *conn, SMB_ACL_PERMSET_T permset)
-{
- return default_vfs_ops.sys_acl_clear_perms(conn, permset);
-}
-
-static int fake_perms_sys_acl_add_perm(struct connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm)
-{
- return default_vfs_ops.sys_acl_add_perm(conn, permset, perm);
-}
-
-static char *fake_perms_sys_acl_to_text(struct connection_struct *conn, SMB_ACL_T theacl, ssize_t *plen)
-{
- return default_vfs_ops.sys_acl_to_text(conn, theacl, plen);
-}
-
-static SMB_ACL_T fake_perms_sys_acl_init(struct connection_struct *conn, int count)
-{
- return default_vfs_ops.sys_acl_init(conn, count);
-}
-
-static int fake_perms_sys_acl_create_entry(struct connection_struct *conn, SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry)
-{
- return default_vfs_ops.sys_acl_create_entry(conn, pacl, pentry);
-}
-
-static int fake_perms_sys_acl_set_tag_type(struct connection_struct *conn, SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype)
-{
- return default_vfs_ops.sys_acl_set_tag_type(conn, entry, tagtype);
-}
-
-static int fake_perms_sys_acl_set_qualifier(struct connection_struct *conn, SMB_ACL_ENTRY_T entry, void *qual)
-{
- return default_vfs_ops.sys_acl_set_qualifier(conn, entry, qual);
-}
-
-static int fake_perms_sys_acl_set_permset(struct connection_struct *conn, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset)
-{
- return default_vfs_ops.sys_acl_set_permset(conn, entry, permset);
-}
-
-static int fake_perms_sys_acl_valid(struct connection_struct *conn, SMB_ACL_T theacl )
-{
- return default_vfs_ops.sys_acl_valid(conn, theacl );
-}
-
-static int fake_perms_sys_acl_set_file(struct connection_struct *conn, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
-{
- return default_vfs_ops.sys_acl_set_file(conn, name, acltype, theacl);
-}
-
-static int fake_perms_sys_acl_set_fd(struct files_struct *fsp, int fd, SMB_ACL_T theacl)
-{
- return default_vfs_ops.sys_acl_set_fd(fsp, fd, theacl);
-}
-
-static int fake_perms_sys_acl_delete_def_file(struct connection_struct *conn, const char *path)
-{
- return default_vfs_ops.sys_acl_delete_def_file(conn, path);
-}
-
-static int fake_perms_sys_acl_get_perm(struct connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm)
-{
- return default_vfs_ops.sys_acl_get_perm(conn, permset, perm);
-}
-
-static int fake_perms_sys_acl_free_text(struct connection_struct *conn, char *text)
-{
- return default_vfs_ops.sys_acl_free_text(conn, text);
-}
-
-static int fake_perms_sys_acl_free_acl(struct connection_struct *conn, SMB_ACL_T posix_acl)
-{
- return default_vfs_ops.sys_acl_free_acl(conn, posix_acl);
-}
-
-static int fake_perms_sys_acl_free_qualifier(struct connection_struct *conn, void *qualifier, SMB_ACL_TAG_T tagtype)
-{
- return default_vfs_ops.sys_acl_free_qualifier(conn, qualifier, tagtype);
-}
-#endif
-
-/* VFS operations structure */
-
-static vfs_op_tuple fake_perms_ops[] = {
-
- /* NT File ACL operations */
-#if 0
- {fake_perms_fget_nt_acl, SMB_VFS_OP_FGET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_get_nt_acl, SMB_VFS_OP_GET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_fset_nt_acl, SMB_VFS_OP_FSET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_set_nt_acl, SMB_VFS_OP_SET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT},
-
- /* POSIX ACL operations */
-
- {fake_perms_chmod_acl, SMB_VFS_OP_CHMOD_ACL, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_fchmod_acl, SMB_VFS_OP_FCHMOD_ACL, SMB_VFS_LAYER_TRANSPARENT},
-
- {fake_perms_sys_acl_get_entry, SMB_VFS_OP_SYS_ACL_GET_ENTRY, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_sys_acl_get_tag_type, SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_sys_acl_get_permset, SMB_VFS_OP_SYS_ACL_GET_PERMSET, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_sys_acl_get_qualifier, SMB_VFS_OP_SYS_ACL_GET_QUALIFIER, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_sys_acl_get_file, SMB_VFS_OP_SYS_ACL_GET_FILE, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_sys_acl_get_fd, SMB_VFS_OP_SYS_ACL_GET_FD, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_sys_acl_clear_perms, SMB_VFS_OP_SYS_ACL_CLEAR_PERMS, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_sys_acl_add_perm, SMB_VFS_OP_SYS_ACL_ADD_PERM, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_sys_acl_to_text, SMB_VFS_OP_SYS_ACL_TO_TEXT, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_sys_acl_init, SMB_VFS_OP_SYS_ACL_INIT, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_sys_acl_create_entry, SMB_VFS_OP_SYS_ACL_CREATE_ENTRY, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_sys_acl_set_tag_type, SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_sys_acl_set_qualifier, SMB_VFS_OP_SYS_ACL_SET_QUALIFIER, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_sys_acl_set_permset, SMB_VFS_OP_SYS_ACL_SET_PERMSET, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_sys_acl_valid, SMB_VFS_OP_SYS_ACL_VALID, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_sys_acl_set_file, SMB_VFS_OP_SYS_ACL_SET_FILE, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_sys_acl_set_fd, SMB_VFS_OP_SYS_ACL_SET_FD, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_sys_acl_delete_def_file, SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_sys_acl_get_perm, SMB_VFS_OP_SYS_ACL_GET_PERM, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_sys_acl_free_text, SMB_VFS_OP_SYS_ACL_FREE_TEXT, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_sys_acl_free_acl, SMB_VFS_OP_SYS_ACL_FREE_ACL, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_sys_acl_free_qualifier, SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER, SMB_VFS_LAYER_TRANSPARENT},
-#endif
-
- {fake_perms_stat, SMB_VFS_OP_STAT, SMB_VFS_LAYER_TRANSPARENT},
- {fake_perms_fstat, SMB_VFS_OP_FSTAT, SMB_VFS_LAYER_TRANSPARENT},
- {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP}
-};
-
-/* VFS initialisation - return initialized vfs_op_tuple array back to Samba */
-
-static vfs_op_tuple *fake_perms_init(const struct vfs_ops *def_vfs_ops,
- struct smb_vfs_handle_struct *vfs_handle)
-{
- DEBUG(3, ("Initialising default vfs hooks\n"));
-
- memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops));
-
- /* Remember vfs_handle for further allocation and referencing of private
- information in vfs_handle->data
- */
- fake_perms_handle = vfs_handle;
- return fake_perms_ops;
-}
-
-int vfs_fake_perms_init(void)
-{
- return smb_register_vfs("fake_perms", fake_perms_init, SMB_VFS_INTERFACE_VERSION);
-}
diff --git a/source/passdb/privileges.c b/source/passdb/privileges.c
deleted file mode 100644
index 688053674b9..00000000000
--- a/source/passdb/privileges.c
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * Unix SMB/CIFS implementation.
- *
- * default privileges backend for passdb
- *
- * Copyright (C) Andrew Tridgell 2003
- *
- * 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., 675
- * Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "includes.h"
-
-/*
- this is a local implementation of a privileges backend, with
- privileges stored in a tdb. Most passdb implementations will
- probably use this backend, although some (such as pdb_ldap) will
- store the privileges in another manner.
-
- The basic principle is that the backend should store a list of SIDs
- associated with each right, where a right is a string name such as
- 'SeTakeOwnershipPrivilege'. The SIDs can be of any type, and do not
- need to belong to the local domain.
-
- The way this is used is that certain places in the code which
- require access control will ask the privileges backend 'does this
- user have the following privilege'. The 'user' will be a NT_TOKEN,
- which is essentially just a list of SIDs. If any of those SIDs are
- listed in the list of SIDs for that privilege then the answer will
- be 'yes'. That will usually mean that the user gets unconditional
- access to that functionality, regradless of any ACLs. In this way
- privileges act in a similar fashion to unix setuid bits.
-*/
-
-/*
- The terms 'right' and 'privilege' are used interchangably in this
- file. This follows MSDN convention where the LSA calls are calls on
- 'rights', which really means privileges. My apologies for the
- confusion.
-*/
-
-
-/* 15 seconds seems like an ample time for timeouts on the privileges db */
-#define LOCK_TIMEOUT 15
-
-
-/* the tdb handle for the privileges database */
-static TDB_CONTEXT *tdb;
-
-
-/* initialise the privilege database */
-BOOL privilege_init(void)
-{
- tdb = tdb_open_log(lock_path("privilege.tdb"), 0, TDB_DEFAULT,
- O_RDWR|O_CREAT, 0600);
- if (!tdb) {
- DEBUG(0,("Failed to open privilege database\n"));
- return False;
- }
-
- return True;
-}
-
-/*
- lock the record for a particular privilege (write lock)
-*/
-static NTSTATUS privilege_lock_right(const char *right)
-{
- if (tdb_lock_bystring(tdb, right, LOCK_TIMEOUT) != 0) {
- return NT_STATUS_INTERNAL_ERROR;
- }
- return NT_STATUS_OK;
-}
-
-/*
- unlock the record for a particular privilege (write lock)
-*/
-static void privilege_unlock_right(const char *right)
-{
- tdb_unlock_bystring(tdb, right);
-}
-
-
-/*
- return a list of SIDs that have a particular right
-*/
-NTSTATUS privilege_enum_account_with_right(const char *right,
- uint32 *count,
- DOM_SID **sids)
-{
- TDB_DATA data;
- char *p;
- int i;
-
- if (!tdb) {
- return NT_STATUS_INTERNAL_ERROR;
- }
-
- data = tdb_fetch_by_string(tdb, right);
- if (!data.dptr) {
- *count = 0;
- *sids = NULL;
- return NT_STATUS_OK;
- }
-
- /* count them */
- for (i=0, p=data.dptr; p<data.dptr+data.dsize; i++) {
- p += strlen(p) + 1;
- }
- *count = i;
-
- /* allocate and parse */
- *sids = malloc(sizeof(DOM_SID) * *count);
- if (! *sids) {
- return NT_STATUS_NO_MEMORY;
- }
- for (i=0, p=data.dptr; p<data.dptr+data.dsize; i++) {
- if (!string_to_sid(&(*sids)[i], p)) {
- free(data.dptr);
- return NT_STATUS_INTERNAL_DB_CORRUPTION;
- }
- p += strlen(p) + 1;
- }
-
- free(data.dptr);
-
- return NT_STATUS_OK;
-}
-
-/*
- set what accounts have a given right - this is an internal interface
-*/
-static NTSTATUS privilege_set_accounts_with_right(const char *right,
- uint32 count,
- DOM_SID *sids)
-{
- TDB_DATA data;
- char *p;
- int i;
-
- if (!tdb) {
- return NT_STATUS_INTERNAL_ERROR;
- }
-
- /* allocate the maximum size that we might use */
- data.dptr = malloc(count * ((MAXSUBAUTHS*11) + 30));
- if (!data.dptr) {
- return NT_STATUS_NO_MEMORY;
- }
-
- p = data.dptr;
-
- for (i=0;i<count;i++) {
- sid_to_string(p, &sids[i]);
- p += strlen(p) + 1;
- }
-
- data.dsize = PTR_DIFF(p, data.dptr);
-
- if (tdb_store_by_string(tdb, right, data, TDB_REPLACE) != 0) {
- free(data.dptr);
- return NT_STATUS_INTERNAL_ERROR;
- }
-
- free(data.dptr);
- return NT_STATUS_OK;
-}
-
-
-/*
- add a SID to the list of SIDs for a right
-*/
-NTSTATUS privilege_add_account_right(const char *right,
- DOM_SID *sid)
-{
- NTSTATUS status;
- DOM_SID *current_sids;
- uint32 current_count;
- int i;
-
- status = privilege_lock_right(right);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
-
- status = privilege_enum_account_with_right(right, &current_count, &current_sids);
- if (!NT_STATUS_IS_OK(status)) {
- privilege_unlock_right(right);
- return status;
- }
-
- /* maybe that SID is already listed? this is not an error */
- for (i=0;i<current_count;i++) {
- if (sid_equal(&current_sids[i], sid)) {
- privilege_unlock_right(right);
- free(current_sids);
- return NT_STATUS_OK;
- }
- }
-
- /* add it in */
- current_sids = Realloc(current_sids, sizeof(current_sids[0]) * (current_count+1));
- if (!current_sids) {
- privilege_unlock_right(right);
- return NT_STATUS_NO_MEMORY;
- }
-
- sid_copy(&current_sids[current_count], sid);
- current_count++;
-
- status = privilege_set_accounts_with_right(right, current_count, current_sids);
-
- free(current_sids);
- privilege_unlock_right(right);
-
- return status;
-}
-
-
-/*
- remove a SID from the list of SIDs for a right
-*/
-NTSTATUS privilege_remove_account_right(const char *right,
- DOM_SID *sid)
-{
- NTSTATUS status;
- DOM_SID *current_sids;
- uint32 current_count;
- int i;
-
- status = privilege_lock_right(right);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
-
- status = privilege_enum_account_with_right(right, &current_count, &current_sids);
- if (!NT_STATUS_IS_OK(status)) {
- privilege_unlock_right(right);
- return status;
- }
-
- for (i=0;i<current_count;i++) {
- if (sid_equal(&current_sids[i], sid)) {
- /* found it - so remove it */
- if (current_count-i > 1) {
- memmove(&current_sids[i], &current_sids[i+1],
- sizeof(current_sids[0]) * ((current_count-i)-1));
- }
- current_count--;
- status = privilege_set_accounts_with_right(right,
- current_count,
- current_sids);
- free(current_sids);
- privilege_unlock_right(right);
- return status;
- }
- }
-
- /* removing a right that you don't have is not an error */
-
- safe_free(current_sids);
- privilege_unlock_right(right);
- return NT_STATUS_OK;
-}
-
-
-/*
- an internal function for checking if a SID has a right
-*/
-static BOOL privilege_sid_has_right(DOM_SID *sid, const char *right)
-{
- NTSTATUS status;
- uint32 count;
- DOM_SID *sids;
- int i;
-
- status = privilege_enum_account_with_right(right, &count, &sids);
- if (!NT_STATUS_IS_OK(status)) {
- return False;
- }
- for (i=0;i<count;i++) {
- if (sid_equal(sid, &sids[i])) {
- free(sids);
- return True;
- }
- }
-
- safe_free(sids);
- return False;
-}
-
-/*
- list the rights for an account. This involves traversing the database
-*/
-NTSTATUS privilege_enum_account_rights(DOM_SID *sid,
- uint32 *count,
- char ***rights)
-{
- TDB_DATA key, nextkey;
- char *right;
-
- if (!tdb) {
- return NT_STATUS_INTERNAL_ERROR;
- }
-
- *rights = NULL;
- *count = 0;
-
- for (key = tdb_firstkey(tdb); key.dptr; key = nextkey) {
- nextkey = tdb_nextkey(tdb, key);
-
- right = key.dptr;
-
- if (privilege_sid_has_right(sid, right)) {
- (*rights) = (char **)Realloc(*rights,sizeof(char *) * ((*count)+1));
- if (! *rights) {
- safe_free(nextkey.dptr);
- free(key.dptr);
- return NT_STATUS_NO_MEMORY;
- }
-
- (*rights)[*count] = strdup(right);
- (*count)++;
- }
-
- free(key.dptr);
- }
-
- return NT_STATUS_OK;
-}
diff --git a/source/stf/.cvsignore b/source/stf/.cvsignore
deleted file mode 100644
index 7e99e367f84..00000000000
--- a/source/stf/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-*.pyc \ No newline at end of file
diff --git a/source/stf/README.stf b/source/stf/README.stf
deleted file mode 100644
index 3fbd33cb6cc..00000000000
--- a/source/stf/README.stf
+++ /dev/null
@@ -1,3 +0,0 @@
-This directory contains the Samba Testing Framework, a Python-based
-system for exercising Samba in various ways. It is quite small at the
-moment.
diff --git a/source/stf/info3cache.py b/source/stf/info3cache.py
deleted file mode 100755
index 96d5a1d4596..00000000000
--- a/source/stf/info3cache.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/python
-#
-# Upon a winbindd authentication, test that an info3 record is cached in
-# netsamlogon_cache.tdb and cache records are removed from winbindd_cache.tdb
-#
-
-import comfychair, stf
-from samba import tdb, winbind
-
-#
-# We want to implement the following test on a win2k native mode domain.
-#
-# 1. trash netsamlogon_cache.tdb
-# 2. wbinfo -r DOMAIN\Administrator [FAIL]
-# 3. wbinfo --auth-crap DOMAIN\Administrator%password [PASS]
-# 4. wbinfo -r DOMAIN\Administrator [PASS]
-#
-# Also for step 3 we want to try 'wbinfo --auth-smbd' and
-# 'wbinfo --auth-plaintext'
-#
-
-#
-# TODO: To implement this test we need to be able to
-#
-# - pass username%password combination for an invidivual winbindd request
-# (so we can get the administrator SID so we can clear the info3 cache)
-#
-# - start/restart winbindd (to trash the winbind cache)
-#
-# - from samba import dynconfig (to find location of info3 cache)
-#
-# - be able to modify the winbindd cache (to set/reset individual winbind
-# cache entries)
-#
-# - have --auth-crap present in HEAD
-#
-
-class WinbindAuthCrap(comfychair.TestCase):
- def runtest(self):
- raise comfychair.NotRunError, "not implemented"
-
-class WinbindAuthSmbd(comfychair.TestCase):
- def runtest(self):
- # Grr - winbindd in HEAD doesn't contain the auth_smbd function
- raise comfychair.NotRunError, "no auth_smbd in HEAD"
-
-class WinbindAuthPlaintext(comfychair.TestCase):
- def runtest(self):
- raise comfychair.NotRunError, "not implemented"
-
-tests = [WinbindAuthCrap, WinbindAuthSmbd, WinbindAuthPlaintext]
-
-if __name__ == "__main__":
- comfychair.main(tests)
diff --git a/source/stf/notes.txt b/source/stf/notes.txt
deleted file mode 100644
index 68aca63c237..00000000000
--- a/source/stf/notes.txt
+++ /dev/null
@@ -1,175 +0,0 @@
- -*- indented-text -*-
-
-(set lotus no)
-
-
-
-Notes on using comfychair with Samba (samba testing framework units):
-
-The tests need to rely on some external resources, such as
-
-If suitable resources are not available, need to skip particular
-tests. Must include a message indicating what resources would be
-needed to run that test. (e.g. must be root.)
-
-We want to be able to select and run particular subsets of tests, such
-as "all winbind tests".
-
-We want to keep the number of configurable parameters down as much as
-possible, to make it easy on people running the tests.
-
-Wherever possible, the tests should set up their preconditions, but a
-few basic resources need to be provided by the people running the
-tests. So for example, rather than asking the user for the name of a
-non-root user, we should give the tests the administrator name and
-password, and it can create a new user to use.
-
-This makes it simpler to get the tests running, and possible also
-makes them more reproducible.
-
-In the future, rather than using NT machines provided by the test
-person, we might have a way to drive VMWare non-persistent sessions,
-to make tests even more tightly controlled.
-
-
-Another design question is how to communicate this information to the
-tests. If there's a lot of settings, then it might need to be stored
-in a configuration file.
-
-However, if we succeed in cutting down the number of parameters, then
-it might be straightforward to pass the information on the command
-line or in an environment variable.
-
-Environment variables are probably better because they can't be seen
-by other users, and they are more easily passed down through an
-invocation of "make check".
-
-
-
-Notes on Samba Testing Framework for Unittests
-----------------------------------------------
-
-This is to be read after reading the notes.txt from comfychair. I'm
-proposing a slightly more concrete description of what's described
-there.
-
-The model of having tests require named resources looks useful for
-incorporation into a framework that can be run by many people in
-widely different environments.
-
-Some possible environments for running the test framework in are:
-
- - Casual downloader of Samba compiling from source and just wants
- to run 'make check'. May only have one Unix machine and a
- handful of clients.
-
- - Samba team member with access to a small number of other
- machines or VMware sessions.
-
- - PSA developer who may not have intimate knowledge of Samba
- internals and is only interested in testing against the PSA.
-
- - Non-team hacker wanting to run test suite after making small
- hacks.
-
- - Build farm environment (loaner machine with no physical access
- or root privilege).
-
- - HP BAT.
-
-Developers in most of these environments are also potential test case
-authors. It should be easy for people unfamiliar with the framework
-to write new tests and have them work. We should provide examples and
-the existing tests should well written and understandable.
-
-Different types of tests:
-
- - Tests that check Samba internals and link against
- libbigballofmud.so. For example:
-
- - Upper/lowercase string functions
- - user_in_list() for large lists
-
- - Tests that use the Samba Python extensions.
-
- - Tests that execute Samba command line programs, for example
- smbpasswd.
-
- - Tests that require other resources on the network such as domain
- controllers or PSAs.
-
- - Tests that are performed on the documentation or the source code
- such as:
-
- - grep for common spelling mistakes made by abartlet (-:
- - grep for company copyright (IBM, HP)
-
- - Link to other existing testing frameworks (smbtorture,
- abartlet's bash based build farm tests)
-
-I propose a TestResourceManager which would be instantiated by a test
-case. The test case would require("resourcename") as part of its
-constructor and raise a comfychair.NotRun exception if the resource
-was not present. A TestResource class could be defined which could
-read a configuration file or examine a environment variable and
-register a resource only if some condition was satisfied.
-
-It would be nice to be able to completely separate the PSA testing
-from the test framework. This would entail being able to define test
-resources dynamically, possibly with a plugin type system.
-
-class TestResourceManager:
- def __init__(self, name):
- self.resources = {}
-
- def register(self, resource):
- name = resource.name()
- if self.resources.has_key(name):
- raise "Test manager already has resource %s" % name
- self.resources[name] = resource
-
- def require(self, resource_name):
- if not self.resources.has_key(resource_name):
- raise "Test manager does not have resources %s" % resource_name
-
-class TestResource:
- def __init__(self, name):
- self.name = name
-
- def name(self):
- return self.name
-
-import os
-
-trm = TestResourceManager()
-
-if os.getuid() == 0:
- trm.register(TestResource("root"))
-
-A config-o-matic Python module can take a list of machines and
-administrator%password entries and classify them by operating system
-version and service pack. These resources would be registered with
-the TestResourceManager.
-
-Some random thoughts about named resources for network servers:
-
-require("nt4.sp3")
-require("nt4.domaincontroller")
-require("psa")
-
-Some kind of format for location of passwords, libraries:
-
-require("exec(smbpasswd)")
-require("lib(bigballofmud)")
-
-maybe require("exec.smbpasswd") looks nicer...
-
-The require() function could return a dictionary of configuration
-information or some handle to fetch dynamic information on. We may
-need to create and destroy extra users or print queues. How to manage
-cleanup of dynamic resources?
-
-Requirements for running stf:
-
- - Python, obviously
- - Samba python extensions
diff --git a/source/stf/osver.py b/source/stf/osver.py
deleted file mode 100755
index 68601fa7bb4..00000000000
--- a/source/stf/osver.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/python
-#
-# Utilities for determining the Windows operating system version remotely.
-#
-
-from samba import srvsvc
-
-# Constants
-
-PLATFORM_UNKNOWN = 0
-PLATFORM_WIN9X = 1
-PLATFORM_NT4 = 2
-PLATFORM_NT5 = 3 # Windows 2000
-
-def platform_name(platform_type):
-
- platform_names = { PLATFORM_UNKNOWN: "Unknown",
- PLATFORM_WIN9X: "Windows 9x",
- PLATFORM_NT4: "Windows NT",
- PLATFORM_NT5: "Windows 2000" }
-
- if platform_names.has_key(platform_type):
- return platform_names[platform_type]
-
- return "Unknown"
-
-def platform_type(info101):
- """Determine the operating system type from a SRV_INFO_101."""
-
- if info101['major_version'] == 4 and info101['minor_version'] == 0:
- return PLATFORM_NT4
-
- if info101['major_version'] == 5 and info101['minor_version'] == 0:
- return PLATFORM_NT5
-
- return PLATFORM_UNKNOWN
-
-def is_domain_controller(info101):
- """Return true if the server_type field from a SRV_INFO_101
- indicates a domain controller."""
- return info101['server_type'] & srvsvc.SV_TYPE_DOMAIN_CTRL
-
-def os_version(name):
- info = srvsvc.netservergetinfo("\\\\%s" % name, 101)
- return platform_type(info)
-
-if __name__ == "__main__":
- import sys
- if len(sys.argv) != 2:
- print "Usage: osver.py server"
- sys.exit(0)
- info = srvsvc.netservergetinfo("\\\\%s" % sys.argv[1], 101)
- print "platform type = %d" % platform_type(info)
- if is_domain_controller(info):
- print "%s is a domain controller" % sys.argv[1]
diff --git a/source/stf/spoolss.py b/source/stf/spoolss.py
deleted file mode 100755
index 735291508bc..00000000000
--- a/source/stf/spoolss.py
+++ /dev/null
@@ -1,288 +0,0 @@
-#!/usr/bin/python
-
-import re
-import comfychair, stf
-from samba import spoolss
-
-class PrintServerTest(comfychair.TestCase):
- """An abstract class requiring a print server."""
- def setUp(self):
- # TODO: create a test printer
- self.server = stf.get_server(platform = "nt")
- self.require(self.server != None, "print server required")
- # TODO: remove hardcoded printer name
- self.printername = "p"
- self.uncname = "\\\\%s\\%s" % \
- (self.server["hostname"], self.printername)
-
-class W2kPrintServerTest(comfychair.TestCase):
- """An abstract class requiring a print server."""
- def setUp(self):
- # TODO: create a test printer
- self.server = stf.get_server(platform = "nt5")
- self.require(self.server != None, "print server required")
- # TODO: remove hardcoded printer name
- self.printername = "p"
- self.uncname = "\\\\%s\\%s" % \
- (self.server["hostname"], self.printername)
-
-class CredentialTest(PrintServerTest):
- """An class that calls a function with various sets of credentials."""
- def runTest(self):
-
- bad_user_creds = {"username": "spotty",
- "domain": "dog",
- "password": "bone"}
-
- cases = ((self.server["administrator"], "Admin credentials", 1),
- (bad_user_creds, "Bad credentials", 0))
-
- # TODO: add unpriv user case
-
- for creds, testname, result in cases:
- try:
- self.runTestArg(creds)
- except:
- if result:
- import traceback
- traceback.print_exc()
- self.fail("rpc with creds %s failed when it "
- "should have suceeded" % creds)
- return
-
- if not result:
- self.fail("rpc with creds %s suceeded when it should "
- "have failed" % creds)
-
-class ArgTestServer(PrintServerTest):
- """Test a RPC that takes a UNC print server name."""
- def runTest(self):
-
- # List of test cases, %s substituted for server name
-
- cases = (("", "No server name", 0),
- ("\\\\%s", "Valid server name", 1),
- ("\\%s", "Invalid unc server name", 0),
- ("\\\\%s__", "Invalid unc server name", 0))
-
- for unc, testname, result in cases:
- unc = re.sub("%s", self.server["hostname"], unc)
- try:
- self.runTestArg(unc)
- except:
- if result:
- self.fail("rpc(\"%s\") failed when it should have "
- "suceeded" % unc)
- return
-
- if not result:
- # Suceeded when we should have failed
- self.fail("rpc(\"%s\") suceeded when it should have "
- "failed" % unc)
-
-class ArgTestServerAndPrinter(ArgTestServer):
- """Test a RPC that takes a UNC print server or UNC printer name."""
- def runTest(self):
-
- ArgTestServer.runTest(self)
-
- # List of test cases, %s substituted for server name, %p substituted
- # for printer name.
-
- cases = (("\\\\%s\\%p", "Valid server and printer name", 1),
- ("\\\\%s\\%p__", "Valid server, invalid printer name", 0),
- ("\\\\%s__\\%p", "Invalid server, valid printer name", 0))
-
- for unc, testname, result in cases:
- unc = re.sub("%s", self.server["hostname"], unc)
- unc = re.sub("%p", self.printername, unc)
- try:
- self.runTestArg(unc)
- except:
- if result:
- self.fail("openprinter(\"%s\") failed when it should have "
- "suceeded" % unc)
- return
-
- if not result:
- # Suceeded when we should have failed
- self.fail("openprinter(\"%s\") suceeded when it should have "
- "failed" % unc)
-
-class OpenPrinterArg(ArgTestServerAndPrinter):
- """Test the OpenPrinter RPC with combinations of valid and invalid
- server and printer names."""
- def runTestArg(self, unc):
- spoolss.openprinter(unc)
-
-class OpenPrinterCred(CredentialTest):
- """Test opening printer with good and bad credentials."""
- def runTestArg(self, creds):
- spoolss.openprinter(self.uncname, creds = creds)
-
-class ClosePrinter(PrintServerTest):
- """Test the ClosePrinter RPC on a printer handle."""
- def runTest(self):
- hnd = spoolss.openprinter(self.uncname)
- spoolss.closeprinter(hnd)
-
-class ClosePrinterServer(PrintServerTest):
- """Test the ClosePrinter RPC on a print server handle."""
- def runTest(self):
- hnd = spoolss.openprinter("\\\\%s" % self.server["hostname"])
- spoolss.closeprinter(hnd)
-
-class GetPrinterInfo(PrintServerTest):
- """Retrieve printer info at various levels."""
-
- # Sample printer data
-
- sample_info = {
- 0: {'printer_errors': 0, 'unknown18': 0, 'unknown13': 0, 'unknown26': 0, 'cjobs': 0, 'unknown11': 0, 'server_name': '\\\\win2kdc1', 'total_pages': 0, 'unknown15': 586, 'unknown16': 0, 'month': 2, 'unknown20': 0, 'second': 23, 'unknown22': 983040, 'unknown25': 0, 'total_bytes': 0, 'unknown27': 0, 'year': 2003, 'build_version': 2195, 'unknown28': 0, 'global_counter': 4, 'day': 13, 'minute': 53, 'total_jobs': 0, 'unknown29': 1114112, 'name': '\\\\win2kdc1\\p', 'hour': 2, 'level': 0, 'c_setprinter': 0, 'change_id': 522454169, 'major_version': 5, 'unknown23': 15, 'day_of_week': 4, 'unknown14': 1, 'session_counter': 2, 'status': 1, 'unknown7': 1, 'unknown8': 0, 'unknown9': 0, 'milliseconds': 421, 'unknown24': 0},
- 1: {'comment': "I'm a teapot!", 'level': 1, 'flags': 8388608, 'name': '\\\\win2kdc1\\p', 'description': '\\\\win2kdc1\\p,HP LaserJet 4,Canberra office'},
- 2: {'comment': "I'm a teapot!", 'status': 1, 'print_processor': 'WinPrint', 'until_time': 0, 'share_name': 'p', 'start_time': 0, 'device_mode': {'icm_method': 1, 'bits_per_pel': 0, 'log_pixels': 0, 'orientation': 1, 'panning_width': 0, 'color': 2, 'pels_width': 0, 'print_quality': 600, 'driver_version': 24, 'display_flags': 0, 'y_resolution': 600, 'media_type': 0, 'display_frequency': 0, 'icm_intent': 0, 'pels_height': 0, 'reserved1': 0, 'size': 220, 'scale': 100, 'dither_type': 0, 'panning_height': 0, 'default_source': 7, 'duplex': 1, 'fields': 16131, 'spec_version': 1025, 'copies': 1, 'device_name': '\\\\win2kdc1\\p', 'paper_size': 1, 'paper_length': 0, 'private': 'private', 'collate': 0, 'paper_width': 0, 'form_name': 'Letter', 'reserved2': 0, 'tt_option': 0}, 'port_name': 'LPT1:', 'sepfile': '', 'parameters': '', 'security_descriptor': {'group_sid': 'S-1-5-21-1606980848-1677128483-854245398-513', 'sacl': None, 'dacl': {'ace_list': [{'flags': 0, 'type': 0, 'mask': 983052, 'trustee': 'S-1-5-32-544'}, {'flags': 9, 'type': 0, 'mask': 983056, 'trustee': 'S-1-5-32-544'}, {'flags': 0, 'type': 0, 'mask': 131080, 'trustee': 'S-1-5-21-1606980848-1677128483-854245398-1121'}, {'flags': 10, 'type': 0, 'mask': 131072, 'trustee': 'S-1-3-0'}, {'flags': 9, 'type': 0, 'mask': 983056, 'trustee': 'S-1-3-0'}, {'flags': 0, 'type': 0, 'mask': 131080, 'trustee': 'S-1-5-21-1606980848-1677128483-854245398-1124'}, {'flags': 0, 'type': 0, 'mask': 131080, 'trustee': 'S-1-1-0'}, {'flags': 0, 'type': 0, 'mask': 983052, 'trustee': 'S-1-5-32-550'}, {'flags': 9, 'type': 0, 'mask': 983056, 'trustee': 'S-1-5-32-550'}, {'flags': 0, 'type': 0, 'mask': 983052, 'trustee': 'S-1-5-32-549'}, {'flags': 9, 'type': 0, 'mask': 983056, 'trustee': 'S-1-5-32-549'}, {'flags': 0, 'type': 0, 'mask': 983052, 'trustee': 'S-1-5-21-1606980848-1677128483-854245398-1106'}], 'revision': 2}, 'owner_sid': 'S-1-5-32-544', 'revision': 1}, 'name': '\\\\win2kdc1\\p', 'server_name': '\\\\win2kdc1', 'level': 2, 'datatype': 'RAW', 'cjobs': 0, 'average_ppm': 0, 'priority': 1, 'driver_name': 'HP LaserJet 4', 'location': 'Canberra office', 'attributes': 8776, 'default_priority': 0},
- 3: {'flags': 4, 'security_descriptor': {'group_sid': 'S-1-5-21-1606980848-1677128483-854245398-513', 'sacl': None, 'dacl': {'ace_list': [{'flags': 0, 'type': 0, 'mask': 983052, 'trustee': 'S-1-5-32-544'}, {'flags': 9, 'type': 0, 'mask': 983056, 'trustee': 'S-1-5-32-544'}, {'flags': 0, 'type': 0, 'mask': 131080, 'trustee': 'S-1-5-21-1606980848-1677128483-854245398-1121'}, {'flags': 10, 'type': 0, 'mask': 131072, 'trustee': 'S-1-3-0'}, {'flags': 9, 'type': 0, 'mask': 983056, 'trustee': 'S-1-3-0'}, {'flags': 0, 'type': 0, 'mask': 131080, 'trustee': 'S-1-5-21-1606980848-1677128483-854245398-1124'}, {'flags': 0, 'type': 0, 'mask': 131080, 'trustee': 'S-1-1-0'}, {'flags': 0, 'type': 0, 'mask': 983052, 'trustee': 'S-1-5-32-550'}, {'flags': 9, 'type': 0, 'mask': 983056, 'trustee': 'S-1-5-32-550'}, {'flags': 0, 'type': 0, 'mask': 983052, 'trustee': 'S-1-5-32-549'}, {'flags': 9, 'type': 0, 'mask': 983056, 'trustee': 'S-1-5-32-549'}, {'flags': 0, 'type': 0, 'mask': 983052, 'trustee': 'S-1-5-21-1606980848-1677128483-854245398-1106'}], 'revision': 2}, 'owner_sid': 'S-1-5-32-544', 'revision': 1}, 'level': 3}
- }
-
- def runTest(self):
- self.hnd = spoolss.openprinter(self.uncname)
-
- # Everyone should have getprinter levels 0-3
-
- for i in (0, 1, 2, 3):
- info = self.hnd.getprinter(level = i)
- try:
- stf.dict_check(self.sample_info[i], info)
- except ValueError, msg:
- raise "info%d: %s" % (i, msg)
-
-class EnumPrinters(PrintServerTest):
- """Enumerate print info at various levels."""
-
- sample_info = {
-
- 0: {'q': {'printer_errors': 0, 'unknown18': 0, 'unknown13': 0, 'unknown26': 0, 'cjobs': 0, 'unknown11': 0, 'server_name': '', 'total_pages': 0, 'unknown15': 586, 'unknown16': 0, 'month': 2, 'unknown20': 0, 'second': 23, 'unknown22': 983040, 'unknown25': 0, 'total_bytes': 0, 'unknown27': 0, 'year': 2003, 'build_version': 2195, 'unknown28': 0, 'global_counter': 4, 'day': 13, 'minute': 53, 'total_jobs': 0, 'unknown29': -1833435136, 'name': 'q', 'hour': 2, 'level': 0, 'c_setprinter': 0, 'change_id': 522454169, 'major_version': 5, 'unknown23': 15, 'day_of_week': 4, 'unknown14': 1, 'session_counter': 1, 'status': 0, 'unknown7': 1, 'unknown8': 0, 'unknown9': 0, 'milliseconds': 421, 'unknown24': 0}, 'p': {'printer_errors': 0, 'unknown18': 0, 'unknown13': 0, 'unknown26': 0, 'cjobs': 0, 'unknown11': 0, 'server_name': '', 'total_pages': 0, 'unknown15': 586, 'unknown16': 0, 'month': 2, 'unknown20': 0, 'second': 23, 'unknown22': 983040, 'unknown25': 0, 'total_bytes': 0, 'unknown27': 0, 'year': 2003, 'build_version': 2195, 'unknown28': 0, 'global_counter': 4, 'day': 13, 'minute': 53, 'total_jobs': 0, 'unknown29': -1831337984, 'name': 'p', 'hour': 2, 'level': 0, 'c_setprinter': 0, 'change_id': 522454169, 'major_version': 5, 'unknown23': 15, 'day_of_week': 4, 'unknown14': 1, 'session_counter': 1, 'status': 1, 'unknown7': 1, 'unknown8': 0, 'unknown9': 0, 'milliseconds': 421, 'unknown24': 0}, 'magpie': {'printer_errors': 0, 'unknown18': 0, 'unknown13': 0, 'unknown26': 0, 'cjobs': 0, 'unknown11': 0, 'server_name': '', 'total_pages': 0, 'unknown15': 586, 'unknown16': 0, 'month': 2, 'unknown20': 0, 'second': 23, 'unknown22': 983040, 'unknown25': 0, 'total_bytes': 0, 'unknown27': 0, 'year': 2003, 'build_version': 2195, 'unknown28': 0, 'global_counter': 4, 'day': 13, 'minute': 53, 'total_jobs': 0, 'unknown29': 1114112, 'name': 'magpie', 'hour': 2, 'level': 0, 'c_setprinter': 0, 'change_id': 522454169, 'major_version': 5, 'unknown23': 15, 'day_of_week': 4, 'unknown14': 1, 'session_counter': 1, 'status': 0, 'unknown7': 1, 'unknown8': 0, 'unknown9': 0, 'milliseconds': 421, 'unknown24': 0}},
-
- 1: {'q': {'comment': 'cheepy birds', 'level': 1, 'flags': 8388608, 'name': 'q', 'description': 'q,HP LaserJet 4,'}, 'p': {'comment': "I'm a teapot!", 'level': 1, 'flags': 8388608, 'name': 'p', 'description': 'p,HP LaserJet 4,Canberra office'}, 'magpie': {'comment': '', 'level': 1, 'flags': 8388608, 'name': 'magpie', 'description': 'magpie,Generic / Text Only,'}}
- }
-
- def runTest(self):
- for i in (0, 1):
- info = spoolss.enumprinters(
- "\\\\%s" % self.server["hostname"], level = i)
- try:
- stf.dict_check(self.sample_info[i], info)
- except ValueError, msg:
- raise "info%d: %s" % (i, msg)
-
-class EnumPrintersArg(ArgTestServer):
- def runTestArg(self, unc):
- spoolss.enumprinters(unc)
-
-class EnumPrintersCred(CredentialTest):
- """Test opening printer with good and bad credentials."""
- def runTestArg(self, creds):
- spoolss.enumprinters(
- "\\\\%s" % self.server["hostname"], creds = creds)
-
-class EnumPrinterdrivers(PrintServerTest):
-
- sample_info = {
- 1: {'Okipage 10ex (PCL5E) : STANDARD': {'name': 'Okipage 10ex (PCL5E) : STANDARD', 'level': 1}, 'Generic / Text Only': {'name': 'Generic / Text Only', 'level': 1}, 'Brother HL-1030 series': {'name': 'Brother HL-1030 series', 'level': 1}, 'Brother HL-1240 series': {'name': 'Brother HL-1240 series', 'level': 1}, 'HP DeskJet 1220C Printer': {'name': 'HP DeskJet 1220C Printer', 'level': 1}, 'HP LaserJet 4100 PCL 6': {'name': 'HP LaserJet 4100 PCL 6', 'level': 1}, 'HP LaserJet 4': {'name': 'HP LaserJet 4', 'level': 1}},
- 2: {'Okipage 10ex (PCL5E) : STANDARD': {'version': 2, 'config_file': '\\\\WIN2KDC1\\print$\\W32X86\\2\\RASDDUI.DLL', 'name': 'Okipage 10ex (PCL5E) : STANDARD', 'driver_path': '\\\\WIN2KDC1\\print$\\W32X86\\2\\RASDD.DLL', 'data_file': '\\\\WIN2KDC1\\print$\\W32X86\\2\\OKIPAGE.DLL', 'level': 2, 'architecture': 'Windows NT x86'}, 'Generic / Text Only': {'version': 3, 'config_file': '\\\\WIN2KDC1\\print$\\W32X86\\3\\UNIDRVUI.DLL', 'name': 'Generic / Text Only', 'driver_path': '\\\\WIN2KDC1\\print$\\W32X86\\3\\UNIDRV.DLL', 'data_file': '\\\\WIN2KDC1\\print$\\W32X86\\3\\TTY.GPD', 'level': 2, 'architecture': 'Windows NT x86'}, 'Brother HL-1030 series': {'version': 3, 'config_file': '\\\\WIN2KDC1\\print$\\W32X86\\3\\BRUHL99A.DLL', 'name': 'Brother HL-1030 series', 'driver_path': '\\\\WIN2KDC1\\print$\\W32X86\\3\\BROHL99A.DLL', 'data_file': '\\\\WIN2KDC1\\print$\\W32X86\\3\\BROHL103.PPD', 'level': 2, 'architecture': 'Windows NT x86'}, 'Brother HL-1240 series': {'version': 3, 'config_file': '\\\\WIN2KDC1\\print$\\W32X86\\3\\BRUHL99A.DLL', 'name': 'Brother HL-1240 series', 'driver_path': '\\\\WIN2KDC1\\print$\\W32X86\\3\\BROHL99A.DLL', 'data_file': '\\\\WIN2KDC1\\print$\\W32X86\\3\\BROHL124.PPD', 'level': 2, 'architecture': 'Windows NT x86'}, 'HP DeskJet 1220C Printer': {'version': 3, 'config_file': '\\\\WIN2KDC1\\print$\\W32X86\\3\\HPW8KMD.DLL', 'name': 'HP DeskJet 1220C Printer', 'driver_path': '\\\\WIN2KDC1\\print$\\W32X86\\3\\HPW8KMD.DLL', 'data_file': '\\\\WIN2KDC1\\print$\\W32X86\\3\\HPW8KMD.DLL', 'level': 2, 'architecture': 'Windows NT x86'}, 'HP LaserJet 4100 PCL 6': {'version': 3, 'config_file': '\\\\WIN2KDC1\\print$\\W32X86\\3\\HPBF042E.DLL', 'name': 'HP LaserJet 4100 PCL 6', 'driver_path': '\\\\WIN2KDC1\\print$\\W32X86\\3\\HPBF042G.DLL', 'data_file': '\\\\WIN2KDC1\\print$\\W32X86\\3\\HPBF042I.PMD', 'level': 2, 'architecture': 'Windows NT x86'}, 'HP LaserJet 4': {'version': 2, 'config_file': '\\\\WIN2KDC1\\print$\\W32X86\\2\\hpblff0.dll', 'name': 'HP LaserJet 4', 'driver_path': '\\\\WIN2KDC1\\print$\\W32X86\\2\\hpblff2.dll', 'data_file': '\\\\WIN2KDC1\\print$\\W32X86\\2\\hpblff39.pmd', 'level': 2, 'architecture': 'Windows NT x86'}}
- }
-
- def runTest(self):
- for i in (1, 2):
- info = spoolss.enumprinterdrivers(
- "\\\\%s" % self.server["hostname"], level = i)
- try:
- if not self.sample_info.has_key(i):
- self.log("%s" % info)
- self.fail()
- stf.dict_check(self.sample_info[i], info)
- except ValueError, msg:
- raise "info%d: %s" % (i, msg)
-
-class EnumPrinterdriversArg(ArgTestServer):
- def runTestArg(self, unc):
- spoolss.enumprinterdrivers(unc)
-
-class EnumPrinterdriversCred(CredentialTest):
- """Test opening printer with good and bad credentials."""
- def runTestArg(self, creds):
- spoolss.enumprinterdrivers(
- "\\\\%s" % self.server["hostname"], creds = creds)
-
-def usage():
- print "Usage: spoolss.py [options] [test1[,test2...]]"
- print "\t -v/--verbose Display debugging information"
- print "\t -l/--list-tests List available tests"
- print
- print "A list of comma separated test names or regular expressions"
- print "can be used to filter the tests performed."
-
-def test_match(subtest_list, test_name):
- """Return true if a test matches a comma separated list of regular
- expression of test names."""
- # re.match does an implicit ^ at the start of the pattern.
- # Explicitly anchor to end to avoid matching substrings.
- for s in string.split(subtest_list, ","):
- if re.match(s + "$", test_name):
- return 1
- return 0
-
-if __name__ == "__main__":
- import os, sys, string
- import getopt
-
- try:
- opts, args = getopt.getopt(sys.argv[1:], "vl", \
- ["verbose", "list-tests"])
- except getopt.GetoptError:
- usage()
- sys.exit(0)
-
- verbose = 0
- list_tests = 0
-
- for opt, arg in opts:
- if opt in ("-v", "--verbose"):
- verbose = 1
- if opt in ("-l", "--list-tests"):
- list_tests = 1
-
- if len(args) > 1:
- usage()
- sys.exit(0)
-
- test_list = [
- OpenPrinterArg,
- OpenPrinterCred,
- ClosePrinter,
- ClosePrinterServer,
- GetPrinterInfo,
- EnumPrinters,
- EnumPrintersCred,
- EnumPrintersArg,
- EnumPrinterdrivers,
- EnumPrinterdriversCred,
- EnumPrinterdriversArg,
- ]
-
- if len(args):
- t = []
- for test in test_list:
- if test_match(args[0], test.__name__):
- t.append(test)
- test_list = t
-
- if os.environ.has_key("SAMBA_DEBUG"):
- spoolss.setup_logging(interactive = 1)
- spoolss.set_debuglevel(10)
-
- if list_tests:
- for test in test_list:
- print test.__name__
- else:
- comfychair.runtests(test_list, verbose = verbose)
diff --git a/source/stf/standardcheck.py b/source/stf/standardcheck.py
deleted file mode 100644
index 5af1c78376d..00000000000
--- a/source/stf/standardcheck.py
+++ /dev/null
@@ -1,33 +0,0 @@
-#! /usr/bin/python
-
-# Comfychair test cases for Samba
-
-# Copyright (C) 2003 by Martin Pool <mbp@samba.org>
-#
-# 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
-
-"""These tests are run by Samba's "make check"."""
-
-import strings, comfychair
-
-# There should not be any actual tests in here: this file just serves
-# to define the ones run by default. They're imported from other
-# modules.
-
-tests = strings.tests
-
-if __name__ == '__main__':
- comfychair.main(tests)
diff --git a/source/stf/stf.py b/source/stf/stf.py
deleted file mode 100755
index ee0ff735612..00000000000
--- a/source/stf/stf.py
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/usr/bin/python
-#
-# Samba Testing Framework for Unit-testing
-#
-
-import os, string, re
-import osver
-
-def get_server_list_from_string(s):
-
- server_list = []
-
- # Format is a list of server:domain\username%password separated
- # by commas.
-
- for entry in string.split(s, ","):
-
- # Parse entry
-
- m = re.match("(.*):(.*)(\\\\|/)(.*)%(.*)", entry)
- if not m:
- raise "badly formed server list entry '%s'" % entry
-
- server = m.group(1)
- domain = m.group(2)
- username = m.group(4)
- password = m.group(5)
-
- # Categorise servers
-
- server_list.append({"platform": osver.os_version(server),
- "hostname": server,
- "administrator": {"username": username,
- "domain": domain,
- "password" : password}})
-
- return server_list
-
-def get_server_list():
- """Iterate through all sources of server info and append them all
- in one big list."""
-
- server_list = []
-
- # The $STF_SERVERS environment variable
-
- if os.environ.has_key("STF_SERVERS"):
- server_list = server_list + \
- get_server_list_from_string(os.environ["STF_SERVERS"])
-
- return server_list
-
-def get_server(platform = None):
- """Return configuration information for a server. The platform
- argument can be a string either 'nt4' or 'nt5' for Windows NT or
- Windows 2000 servers, or just 'nt' for Windows NT and higher."""
-
- server_list = get_server_list()
-
- for server in server_list:
- if platform:
- p = server["platform"]
- if platform == "nt":
- if (p == osver.PLATFORM_NT4 or p == osver.PLATFORM_NT5):
- return server
- if platform == "nt4" and p == osver.PLATFORM_NT4:
- return server
- if platform == "nt5" and p == osver.PLATFORM_NT5:
- return server
- else:
- # No filter defined, return first in list
- return server
-
- return None
-
-def dict_check(sample_dict, real_dict):
- """Check that real_dict contains all the keys present in sample_dict
- and no extras. Also check that common keys are of them same type."""
- tmp = real_dict.copy()
- for key in sample_dict.keys():
- # Check existing key and type
- if not real_dict.has_key(key):
- raise ValueError, "dict does not contain key '%s'" % key
- if type(sample_dict[key]) != type(real_dict[key]):
- raise ValueError, "dict has differing types (%s vs %s) for key " \
- "'%s'" % (type(sample_dict[key]), type(real_dict[key]), key)
- # Check dictionaries recursively
- if type(sample_dict[key]) == dict:
- dict_check(sample_dict[key], real_dict[key])
- # Delete visited keys from copy
- del(tmp[key])
- # Any keys leftover are present in the real dict but not the sample
- if len(tmp) == 0:
- return
- result = "dict has extra keys: "
- for key in tmp.keys():
- result = result + key + " "
- raise ValueError, result
-
-if __name__ == "__main__":
- print get_server(platform = "nt")
diff --git a/source/stf/strings.py b/source/stf/strings.py
deleted file mode 100755
index a67e1370588..00000000000
--- a/source/stf/strings.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#! /usr/bin/python
-
-# Comfychair test cases for Samba string functions.
-
-# Copyright (C) 2003 by Martin Pool <mbp@samba.org>
-#
-# 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, re, comfychair
-
-def signum(a):
- if a < 0:
- return -1
- elif a > 0:
- return +1
- else:
- return 0
-
-
-class StrCaseCmp_Ascii_Tests(comfychair.TestCase):
- """String comparisons in simple ASCII"""
- def run_strcmp(self, a, b, expect):
- out = self.runcmd('t_strcmp \"%s\" \"%s\"' % (a, b))
- if signum(int(out)) != expect:
- self.fail("comparison failed:\n"
- " a=%s\n"
- " b=%s\n"
- " expected=%s\n"
- " result=%s\n" % (`a`, `b`, `expect`, `out`))
-
- def runtest(self):
- # A, B, strcasecmp(A, B)
- cases = [('hello', 'hello', 0),
- ('hello', 'goodbye', +1),
- ('goodbye', 'hello', -1),
- ('hell', 'hello', -1),
- ('', '', 0),
- ('a', '', +1),
- ('', 'a', -1),
- ('a', 'A', 0),
- ('aa', 'aA', 0),
- ('Aa', 'aa', 0),
- ('longstring ' * 100, 'longstring ' * 100, 0),
- ('longstring ' * 100, 'longstring ' * 100 + 'a', -1),
- ('longstring ' * 100 + 'a', 'longstring ' * 100, +1),
- ]
- for a, b, expect in cases:
- self.run_strcmp(a, b, expect)
-
-# Define the tests exported by this module
-tests = [StrCaseCmp_Ascii_Tests]
-
-# Handle execution of this file as a main program
-if __name__ == '__main__':
- comfychair.main(tests)
-
diff --git a/source/stf/test.py b/source/stf/test.py
deleted file mode 100755
index fb57926cc3a..00000000000
--- a/source/stf/test.py
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/python
-
-# meta-test-case / example for comfychair. Should demonstrate
-# different kinds of failure.
-
-import comfychair
-
-class NormalTest(comfychair.TestCase):
- def runtest(self):
- pass
-
-class RootTest(comfychair.TestCase):
- def setup(self):
- self.require_root()
-
- def runTest(self):
- pass
-
-class GoodExecTest(comfychair.TestCase):
- def runtest(self):
- stdout = self.runcmd("ls -l")
-
-class BadExecTest(comfychair.TestCase):
- def setup(self):
- exit, stdout = self.runcmd_unchecked("spottyfoot --slobber",
- skip_on_noexec = 1)
-
-
-tests = [NormalTest, RootTest, GoodExecTest, BadExecTest]
-
-if __name__ == '__main__':
- comfychair.main(tests)
-
diff --git a/source/torture/t_stringoverflow.c b/source/torture/t_stringoverflow.c
deleted file mode 100644
index ec14d81189e..00000000000
--- a/source/torture/t_stringoverflow.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include "includes.h"
-
- int main(void)
-{
- fstring dest;
- char *ptr = dest;
-
- printf("running on valgrind? %d\n", RUNNING_ON_VALGRIND);
-
- /* Try copying a string into an fstring buffer. The string
- * will actually fit, but this is still wrong because you
- * can't pstrcpy into an fstring. This should trap in a
- * developer build. */
-
-#if 0
- /* As of CVS 20030318, this will be trapped at compile time! */
- pstrcpy(dest, "hello");
-#endif /* 0 */
-
- pstrcpy(ptr, "hello!");
-
- return 0;
-}