diff options
author | Gerald Carter <jerry@samba.org> | 2003-07-16 04:34:08 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2003-07-16 04:34:08 +0000 |
commit | dcfcae7c92a9c923d5bc5e9a7f02a02516449eec (patch) | |
tree | d5941793bcae550bedc4c82ba4345c1fe7621d10 | |
parent | 1acf0a8103c580c8ba7d5a610d37192703d85dcd (diff) | |
download | samba-dcfcae7c92a9c923d5bc5e9a7f02a02516449eec.tar.gz |
more syncs with 3.0
-rwxr-xr-x | docs/docbook/scripts/find_missing_doc.pl | 57 | ||||
-rw-r--r-- | docs/docbook/smbdotconf/security/nonunixaccountrange.xml | 25 | ||||
-rw-r--r-- | docs/docbook/smbdotconf/tuning/statcachesize.xml | 12 | ||||
-rw-r--r-- | packaging/Debian/debian/libsmbclient.postinst | 11 | ||||
-rw-r--r-- | packaging/Debian/debian/patches/configure.patch | 32 | ||||
-rw-r--r-- | packaging/Debian/debian/samba-common.conffiles | 3 | ||||
-rw-r--r-- | packaging/Debian/debian/samba.conffiles | 3 | ||||
-rw-r--r-- | packaging/Debian/debian/winbind.conffiles | 2 | ||||
-rw-r--r-- | source/bin/.cvsignore | 52 | ||||
-rw-r--r-- | source/nsswitch/winbindd_idmap.c | 194 | ||||
-rw-r--r-- | source/nsswitch/winbindd_idmap_tdb.c | 459 | ||||
-rw-r--r-- | source/nsswitch/winbindd_passdb.c | 360 | ||||
-rw-r--r-- | source/pam_smbpass/.cvsignore | 1 | ||||
-rw-r--r-- | source/sam/idmap_winbind.c | 165 | ||||
-rwxr-xr-x | source/script/cvslog.pl | 102 | ||||
-rwxr-xr-x | source/script/find_missing_doc.pl | 90 |
16 files changed, 58 insertions, 1510 deletions
diff --git a/docs/docbook/scripts/find_missing_doc.pl b/docs/docbook/scripts/find_missing_doc.pl new file mode 100755 index 00000000000..2875cf77b8b --- /dev/null +++ b/docs/docbook/scripts/find_missing_doc.pl @@ -0,0 +1,57 @@ +#!/usr/bin/perl + +my %doc; + +$topdir = (shift @ARGV) or $topdir = "."; + +################################################## +# Reading links from manpage + +$curdir = $ENV{PWD}; + +chdir($topdir."/docs/docbook/smbdotconf"); + +open(IN,"xsltproc --xinclude --param smb.context ALL generate-context.xsl parameters.all.xml|"); + +while(<IN>) { + if( /<listitem><para><link linkend="([^"]*)"><parameter moreinfo="none">([^<]*)<\/parameter><\/link><\/para><\/listitem>/g ){ + $doc{$2} = $1; + } +} + +close(IN); + +chdir($curdir); + +################################################# +# Reading entries from source code + + +open(SOURCE,"$topdir/source/param/loadparm.c") or die("Can't open $topdir/source/param/loadparm.c: $!"); + +while ($ln = <SOURCE>) { + last if $ln =~ m/^static\ struct\ parm_struct\ parm_table.*/; +} #burn through the preceding lines + +while ($ln = <SOURCE>) { + last if $ln =~ m/^\s*\}\;\s*$/; + #pull in the param names only + next if $ln =~ m/.*P_SEPARATOR.*/; + next unless $ln =~ /\s*\{\"(.*)\".*/; + + if($doc{lc($1)}) { + $doc{lc($1)} = "FOUND"; + } else { + print "$1 is not documented!\n"; + } +} +close SOURCE; + +################################################## +# Trying to find missing references + +foreach (keys %doc) { + if($doc{$_} cmp "FOUND") { + print "$_ is documented but is not a configuration option!\n"; + } +} diff --git a/docs/docbook/smbdotconf/security/nonunixaccountrange.xml b/docs/docbook/smbdotconf/security/nonunixaccountrange.xml deleted file mode 100644 index 4004af2d948..00000000000 --- a/docs/docbook/smbdotconf/security/nonunixaccountrange.xml +++ /dev/null @@ -1,25 +0,0 @@ -<samba:parameter name="non unix account range" - context="G" - advanced="1" developer="1" - xmlns:samba="http://samba.org/common"> -<listitem> - <para>The non unix account range parameter specifies - the range of 'user ids' that are allocated by the various 'non unix - account' passdb backends. These backends allow - the storage of passwords for users who don't exist in /etc/passwd. - This is most often used for machine account creation. - This range of ids should have no existing local or NIS users within - it as strange conflicts can occur otherwise.</para> - - <note> - <para>These userids never appear on the system and Samba will never - 'become' these users. They are used only to ensure that the algorithmic - RID mapping does not conflict with normal users. - </para> - </note> - - <para>Default: <command moreinfo="none">non unix account range = <empty string></command></para> - - <para>Example: <command moreinfo="none">non unix account range = 10000-20000</command></para> -</listitem> -</samba:parameter> diff --git a/docs/docbook/smbdotconf/tuning/statcachesize.xml b/docs/docbook/smbdotconf/tuning/statcachesize.xml deleted file mode 100644 index 0c8d4e0c72a..00000000000 --- a/docs/docbook/smbdotconf/tuning/statcachesize.xml +++ /dev/null @@ -1,12 +0,0 @@ -<samba:parameter name="stat cache size" - context="G" - developer="1" - xmlns:samba="http://samba.org/common"> -<listitem> - <para>This parameter determines the number of - entries in the <parameter moreinfo="none">stat cache</parameter>. You should - never need to change this parameter.</para> - - <para>Default: <command moreinfo="none">stat cache size = 50</command></para> -</listitem> -</samba:parameter> diff --git a/packaging/Debian/debian/libsmbclient.postinst b/packaging/Debian/debian/libsmbclient.postinst deleted file mode 100644 index bd85266cdf9..00000000000 --- a/packaging/Debian/debian/libsmbclient.postinst +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -# -# postinst script for libsmbclient -# -# - -if [ "$1" = "configure" ]; then - ldconfig -fi - -#DEBHELPER# diff --git a/packaging/Debian/debian/patches/configure.patch b/packaging/Debian/debian/patches/configure.patch deleted file mode 100644 index 0cf1434b29d..00000000000 --- a/packaging/Debian/debian/patches/configure.patch +++ /dev/null @@ -1,32 +0,0 @@ -diff -uNr samba-3.0alpha21.orig/source/configure.in samba-3.0alpha21/source/configure.in ---- samba-3.0alpha21.orig/source/configure.in 2003-02-16 13:01:45.000000000 -0600 -+++ samba-3.0alpha21/source/configure.in 2003-02-16 13:04:03.000000000 -0600 -@@ -481,6 +481,28 @@ - #endif - } - ], [LINUX_LFS_SUPPORT=yes], [LINUX_LFS_SUPPORT=no], [LINUX_LFS_SUPPORT=cross]) -+ if test x$LINUX_LFS_SUPPORT = xyes ; then -+ AC_TRY_RUN([ -+#include <unistd.h> -+#include <sys/types.h> -+#include <fcntl.h> -+main() { -+ unsigned int *padding; -+ struct flock foo_lock = {F_WRLCK, SEEK_SET, 0, 1, 0}; -+ int fd = open("/dev/null", O_RDWR); -+ -+ /* Yes, we're depending on the internals of the Linux flock structure -+ here -- but this test is explicitly Linux-specific to begin with. */ -+ padding = (unsigned int *)&foo_lock; -+ padding[1] = 0xffffffff; -+ foo_lock.l_start = 0; -+ if (fcntl(fd, F_SETLK, &foo_lock) < 0) -+ exit(1); -+ -+ exit(0); -+} -+], [LINUX_LFS_SUPPORT=yes], [LINUX_LFS_SUPPORT=no], [LINUX_LFS_SUPPORT=cross]) -+ fi - CPPFLAGS="$old_CPPFLAGS" - if test x$LINUX_LFS_SUPPORT = xyes ; then - CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS" diff --git a/packaging/Debian/debian/samba-common.conffiles b/packaging/Debian/debian/samba-common.conffiles deleted file mode 100644 index 4684ede3d1e..00000000000 --- a/packaging/Debian/debian/samba-common.conffiles +++ /dev/null @@ -1,3 +0,0 @@ -/etc/pam.d/samba -/etc/samba/gdbcommands -/etc/dhcp3/dhclient-enter-hooks.d/samba diff --git a/packaging/Debian/debian/samba.conffiles b/packaging/Debian/debian/samba.conffiles deleted file mode 100644 index 908a791a629..00000000000 --- a/packaging/Debian/debian/samba.conffiles +++ /dev/null @@ -1,3 +0,0 @@ -/etc/cron.daily/samba -/etc/init.d/samba -/etc/logrotate.d/samba diff --git a/packaging/Debian/debian/winbind.conffiles b/packaging/Debian/debian/winbind.conffiles deleted file mode 100644 index c9adbfff174..00000000000 --- a/packaging/Debian/debian/winbind.conffiles +++ /dev/null @@ -1,2 +0,0 @@ -/etc/init.d/winbind -/etc/logrotate.d/winbind diff --git a/source/bin/.cvsignore b/source/bin/.cvsignore deleted file mode 100644 index 770100fd312..00000000000 --- a/source/bin/.cvsignore +++ /dev/null @@ -1,52 +0,0 @@ -*.so -.dummy -.libs -debug2html -editreg -locktest -locktest2 -make_printerdef -make_smbcodepage -make_unicodemap -masktest -msgtest -net -nmbd -nmblookup -nsstest -ntlm_auth -pdbedit -profiles -rpcclient -samsync -samtest -smbcacls -smbcacls -smbclient -smbcontrol -smbcquotas -smbd -smbfilter -smbgroupedit -smbmnt -smbmount -smbpasswd -smbsh -smbspool -smbstatus -smbtorture -smbtree -smbumount -swat -t_push_ucs2 -t_snprintf -t_strcmp -t_stringoverflow -talloctort -tdbbackup -testparm -testprns -vfstest -wbinfo -winbindd -wrepld diff --git a/source/nsswitch/winbindd_idmap.c b/source/nsswitch/winbindd_idmap.c deleted file mode 100644 index 3b23089200f..00000000000 --- a/source/nsswitch/winbindd_idmap.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - Unix SMB/CIFS implementation. - Winbind ID Mapping - Copyright (C) Tim Potter 2000 - Copyright (C) Anthony Liguori <aliguor@us.ibm.com> 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 "winbindd.h" - -static struct { - const char *name; - /* Function to create a member of the idmap_methods list */ - BOOL (*reg_meth)(struct winbindd_idmap_methods **methods); - struct winbindd_idmap_methods *methods; -} builtin_winbindd_idmap_functions[] = { - { "tdb", winbind_idmap_reg_tdb, NULL }, - { NULL, NULL, NULL } -}; - -/* singleton pattern: uberlazy evaluation */ -static struct winbindd_idmap_methods *impl; - -static struct winbindd_idmap_methods *get_impl(const char *name) -{ - int i = 0; - struct winbindd_idmap_methods *ret = NULL; - - while (builtin_winbindd_idmap_functions[i].name && - strcmp(builtin_winbindd_idmap_functions[i].name, name)) { - i++; - } - - if (builtin_winbindd_idmap_functions[i].name) { - if (!builtin_winbindd_idmap_functions[i].methods) { - builtin_winbindd_idmap_functions[i].reg_meth(&builtin_winbindd_idmap_functions[i].methods); - } - - ret = builtin_winbindd_idmap_functions[i].methods; - } - - return ret; -} - -/* Initialize backend */ -BOOL winbindd_idmap_init(void) -{ - BOOL ret = False; - - DEBUG(3, ("winbindd_idmap_init: using '%s' as backend\n", - lp_winbind_backend())); - - if (!impl) { - impl = get_impl(lp_winbind_backend()); - if (!impl) { - DEBUG(0, ("winbindd_idmap_init: could not load backend '%s'\n", - lp_winbind_backend())); - } - } - - if (impl) { - ret = impl->init(); - } - - DEBUG(3, ("winbind_idmap_init: returning %s\n", ret ? "true" : "false")); - - return ret; -} - -/* Get UID from SID */ -BOOL winbindd_idmap_get_uid_from_sid(DOM_SID *sid, uid_t *uid) -{ - BOOL ret = False; - - if (!impl) { - impl = get_impl(lp_winbind_backend()); - if (!impl) { - DEBUG(0, ("winbindd_idmap_init: could not load backend '%s'\n", - lp_winbind_backend())); - } - } - - if (impl) { - ret = impl->get_uid_from_sid(sid, uid); - } - - return ret; -} - -/* Get GID from SID */ -BOOL winbindd_idmap_get_gid_from_sid(DOM_SID *sid, gid_t *gid) -{ - BOOL ret = False; - - if (!impl) { - impl = get_impl(lp_winbind_backend()); - if (!impl) { - DEBUG(0, ("winbindd_idmap_init: could not load backend '%s'\n", - lp_winbind_backend())); - } - } - - if (impl) { - ret = impl->get_gid_from_sid(sid, gid); - } - - return ret; -} - -/* Get SID from UID */ -BOOL winbindd_idmap_get_sid_from_uid(uid_t uid, DOM_SID *sid) -{ - BOOL ret = False; - - if (!impl) { - impl = get_impl(lp_winbind_backend()); - if (!impl) { - DEBUG(0, ("winbindd_idmap_init: could not load backend '%s'\n", - lp_winbind_backend())); - } - } - - if (impl) { - ret = impl->get_sid_from_uid(uid, sid); - } - - return ret; -} - -/* Get SID from GID */ -BOOL winbindd_idmap_get_sid_from_gid(gid_t gid, DOM_SID *sid) -{ - BOOL ret = False; - - if (!impl) { - impl = get_impl(lp_winbind_backend()); - } - - if (impl) { - ret = impl->get_sid_from_gid(gid, sid); - } else { - DEBUG(0, ("winbindd_idmap_init: could not load backend '%s'\n", - lp_winbind_backend())); - } - - return ret; -} - -/* Close backend */ -BOOL winbindd_idmap_close(void) -{ - BOOL ret = False; - - if (!impl) { - impl = get_impl(lp_winbind_backend()); - } - - if (impl) { - ret = impl->close(); - } else { - DEBUG(0, ("winbindd_idmap_init: could not load backend '%s'\n", - lp_winbind_backend())); - } - - return ret; -} - -/* Dump backend status */ -void winbindd_idmap_status(void) -{ - if (!impl) { - impl = get_impl(lp_winbind_backend()); - } - - if (impl) { - impl->status(); - } else { - DEBUG(0, ("winbindd_idmap_init: could not load backend '%s'\n", - lp_winbind_backend())); - } -} diff --git a/source/nsswitch/winbindd_idmap_tdb.c b/source/nsswitch/winbindd_idmap_tdb.c deleted file mode 100644 index 12d6972bae3..00000000000 --- a/source/nsswitch/winbindd_idmap_tdb.c +++ /dev/null @@ -1,459 +0,0 @@ -/* - Unix SMB/CIFS implementation. - - Winbind daemon - user related function - - Copyright (C) Tim Potter 2000 - Copyright (C) Anthony Liguori 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 "winbindd.h" - -#undef DBGC_CLASS -#define DBGC_CLASS DBGC_WINBIND - -/* High water mark keys */ -#define HWM_GROUP "GROUP HWM" -#define HWM_USER "USER HWM" - -/* idmap version determines auto-conversion */ -#define IDMAP_VERSION 2 - -/* Globals */ -static TDB_CONTEXT *idmap_tdb; - -/* convert one record to the new format */ -static int tdb_convert_fn(TDB_CONTEXT * tdb, TDB_DATA key, TDB_DATA data, - void *ignored) -{ - struct winbindd_domain *domain; - char *p; - DOM_SID sid; - uint32 rid; - fstring keystr; - fstring dom_name; - TDB_DATA key2; - - p = strchr(key.dptr, '/'); - if (!p) - return 0; - - *p = 0; - fstrcpy(dom_name, key.dptr); - *p++ = '/'; - - domain = find_domain_from_name(dom_name); - if (!domain) { - /* We must delete the old record. */ - DEBUG(0, - ("winbindd: tdb_convert_fn : Unable to find domain %s\n", - dom_name)); - DEBUG(0, - ("winbindd: tdb_convert_fn : deleting record %s\n", - key.dptr)); - tdb_delete(idmap_tdb, key); - return 0; - } - - rid = atoi(p); - - sid_copy(&sid, &domain->sid); - sid_append_rid(&sid, rid); - - sid_to_string(keystr, &sid); - key2.dptr = keystr; - key2.dsize = strlen(keystr) + 1; - - if (tdb_store(idmap_tdb, key2, data, TDB_INSERT) != 0) { - /* not good! */ - DEBUG(0, - ("winbindd: tdb_convert_fn : Unable to update record %s\n", - key2.dptr)); - DEBUG(0, - ("winbindd: tdb_convert_fn : conversion failed - idmap corrupt ?\n")); - return -1; - } - - if (tdb_store(idmap_tdb, data, key2, TDB_REPLACE) != 0) { - /* not good! */ - DEBUG(0, - ("winbindd: tdb_convert_fn : Unable to update record %s\n", - data.dptr)); - DEBUG(0, - ("winbindd: tdb_convert_fn : conversion failed - idmap corrupt ?\n")); - return -1; - } - - tdb_delete(idmap_tdb, key); - - return 0; -} - -/***************************************************************************** - Convert the idmap database from an older version. -*****************************************************************************/ -static BOOL tdb_idmap_convert(void) -{ - int32 vers = tdb_fetch_int32(idmap_tdb, "IDMAP_VERSION"); - BOOL bigendianheader = - (idmap_tdb->flags & TDB_BIGENDIAN) ? True : False; - - if (vers == IDMAP_VERSION) - return True; - - if (((vers == -1) && bigendianheader) - || (IREV(vers) == IDMAP_VERSION)) { - /* Arrggghh ! Bytereversed or old big-endian - make order independent ! */ - /* - * high and low records were created on a - * big endian machine and will need byte-reversing. - */ - - int32 wm; - - wm = tdb_fetch_int32(idmap_tdb, HWM_USER); - - if (wm != -1) { - wm = IREV(wm); - } else - wm = server_state.uid_low; - - if (tdb_store_int32(idmap_tdb, HWM_USER, wm) == -1) { - DEBUG(0, - ("tdb_idmap_convert: Unable to byteswap user hwm in idmap database\n")); - return False; - } - - wm = tdb_fetch_int32(idmap_tdb, HWM_GROUP); - if (wm != -1) { - wm = IREV(wm); - } else - wm = server_state.gid_low; - - if (tdb_store_int32(idmap_tdb, HWM_GROUP, wm) == -1) { - DEBUG(0, - ("tdb_idmap_convert: Unable to byteswap group hwm in idmap database\n")); - return False; - } - } - - /* the old format stored as DOMAIN/rid - now we store the SID direct */ - tdb_traverse(idmap_tdb, tdb_convert_fn, NULL); - - if (tdb_store_int32(idmap_tdb, "IDMAP_VERSION", IDMAP_VERSION) == - -1) { - DEBUG(0, - ("tdb_idmap_convert: Unable to byteswap group hwm in idmap database\n")); - return False; - } - - return True; -} - -/* Allocate either a user or group id from the pool */ -static BOOL tdb_allocate_id(uid_t * id, BOOL isgroup) -{ - int hwm; - - /* Get current high water mark */ - if ((hwm = tdb_fetch_int32(idmap_tdb, - isgroup ? HWM_GROUP : HWM_USER)) == - -1) { - return False; - } - - /* Return next available uid in list */ - if ((isgroup && (hwm > server_state.gid_high)) || - (!isgroup && (hwm > server_state.uid_high))) { - DEBUG(0, - ("winbind %sid range full!\n", isgroup ? "g" : "u")); - return False; - } - - if (id) { - *id = hwm; - } - - hwm++; - - /* Store new high water mark */ - tdb_store_int32(idmap_tdb, isgroup ? HWM_GROUP : HWM_USER, hwm); - - return True; -} - -/* Get a sid from an id */ -static BOOL tdb_get_sid_from_id(int id, DOM_SID * sid, BOOL isgroup) -{ - TDB_DATA key, data; - fstring keystr; - BOOL result = False; - - slprintf(keystr, sizeof(keystr), "%s %d", isgroup ? "GID" : "UID", - id); - - key.dptr = keystr; - key.dsize = strlen(keystr) + 1; - - data = tdb_fetch(idmap_tdb, key); - - if (data.dptr) { - result = string_to_sid(sid, data.dptr); - SAFE_FREE(data.dptr); - } - - return result; -} - -/* Get an id from a sid */ -static BOOL tdb_get_id_from_sid(DOM_SID * sid, uid_t * id, BOOL isgroup) -{ - TDB_DATA data, key; - fstring keystr; - BOOL result = False; - - /* Check if sid is present in database */ - sid_to_string(keystr, sid); - - key.dptr = keystr; - key.dsize = strlen(keystr) + 1; - - data = tdb_fetch(idmap_tdb, key); - - if (data.dptr) { - fstring scanstr; - int the_id; - - /* Parse and return existing uid */ - fstrcpy(scanstr, isgroup ? "GID" : "UID"); - fstrcat(scanstr, " %d"); - - if (sscanf(data.dptr, scanstr, &the_id) == 1) { - /* Store uid */ - if (id) { - *id = the_id; - } - - result = True; - } - - SAFE_FREE(data.dptr); - } else { - - /* Allocate a new id for this sid */ - if (id && tdb_allocate_id(id, isgroup)) { - fstring keystr2; - - /* Store new id */ - slprintf(keystr2, sizeof(keystr2), "%s %d", - isgroup ? "GID" : "UID", *id); - - data.dptr = keystr2; - data.dsize = strlen(keystr2) + 1; - - tdb_store(idmap_tdb, key, data, TDB_REPLACE); - tdb_store(idmap_tdb, data, key, TDB_REPLACE); - - result = True; - } - } - - return result; -} - -/***************************************************************************** - Initialise idmap database. -*****************************************************************************/ -static BOOL tdb_idmap_init(void) -{ - SMB_STRUCT_STAT stbuf; - - /* move to the new database on first startup */ - if (!file_exist(lock_path("idmap.tdb"), &stbuf)) { - if (file_exist(lock_path("winbindd_idmap.tdb"), &stbuf)) { - char *cmd = NULL; - - /* lazy file copy */ - if (asprintf(&cmd, "cp -p %s/winbindd_idmap.tdb %s/idmap.tdb", lp_lockdir(), lp_lockdir()) != -1) { - system(cmd); - free(cmd); - } - if (!file_exist(lock_path("idmap.tdb"), &stbuf)) { - DEBUG(0, ("idmap_init: Unable to make a new database copy\n")); - return False; - } - } - } - - /* Open tdb cache */ - if (!(idmap_tdb = tdb_open_log(lock_path("idmap.tdb"), 0, - TDB_DEFAULT, O_RDWR | O_CREAT, - 0600))) { - DEBUG(0, - ("winbindd_idmap_init: Unable to open idmap database\n")); - return False; - } - - /* possibly convert from an earlier version */ - if (!tdb_idmap_convert()) { - DEBUG(0, ("winbindd_idmap_init: Unable to open idmap database\n")); - return False; - } - - /* Create high water marks for group and user id */ - if (tdb_fetch_int32(idmap_tdb, HWM_USER) == -1) { - if (tdb_store_int32 - (idmap_tdb, HWM_USER, server_state.uid_low) == -1) { - DEBUG(0, - ("winbindd_idmap_init: Unable to initialise user hwm in idmap database\n")); - return False; - } - } - - if (tdb_fetch_int32(idmap_tdb, HWM_GROUP) == -1) { - if (tdb_store_int32 - (idmap_tdb, HWM_GROUP, server_state.gid_low) == -1) { - DEBUG(0, - ("winbindd_idmap_init: Unable to initialise group hwm in idmap database\n")); - return False; - } - } - - return True; -} - -/* Get a sid from a uid */ -static BOOL tdb_get_sid_from_uid(uid_t uid, DOM_SID * sid) -{ - return tdb_get_sid_from_id((int) uid, sid, False); -} - -/* Get a sid from a gid */ -static BOOL tdb_get_sid_from_gid(gid_t gid, DOM_SID * sid) -{ - return tdb_get_sid_from_id((int) gid, sid, True); -} - -/* Get a uid from a sid */ -static BOOL tdb_get_uid_from_sid(DOM_SID * sid, uid_t * uid) -{ - return tdb_get_id_from_sid(sid, uid, False); -} - -/* Get a gid from a group sid */ -static BOOL tdb_get_gid_from_sid(DOM_SID * sid, gid_t * gid) -{ - return tdb_get_id_from_sid(sid, gid, True); -} - -/* Close the tdb */ -static BOOL tdb_idmap_close(void) -{ - if (idmap_tdb) - return (tdb_close(idmap_tdb) == 0); - return True; -} - - -/* Dump status information to log file. Display different stuff based on - the debug level: - - Debug Level Information Displayed - ================================================================= - 0 Percentage of [ug]id range allocated - 0 High water marks (next allocated ids) -*/ - -#define DUMP_INFO 0 - -static void tdb_idmap_status(void) -{ - int user_hwm, group_hwm; - - DEBUG(0, ("winbindd idmap status:\n")); - - /* Get current high water marks */ - - if ((user_hwm = tdb_fetch_int32(idmap_tdb, HWM_USER)) == -1) { - DEBUG(DUMP_INFO, - ("\tCould not get userid high water mark!\n")); - } - - if ((group_hwm = tdb_fetch_int32(idmap_tdb, HWM_GROUP)) == -1) { - DEBUG(DUMP_INFO, - ("\tCould not get groupid high water mark!\n")); - } - - /* Display next ids to allocate */ - - if (user_hwm != -1) { - DEBUG(DUMP_INFO, - ("\tNext userid to allocate is %d\n", user_hwm)); - } - - if (group_hwm != -1) { - DEBUG(DUMP_INFO, - ("\tNext groupid to allocate is %d\n", group_hwm)); - } - - /* Display percentage of id range already allocated. */ - - if (user_hwm != -1) { - int num_users = user_hwm - server_state.uid_low; - int total_users = - server_state.uid_high - server_state.uid_low; - - DEBUG(DUMP_INFO, - ("\tUser id range is %d%% full (%d of %d)\n", - num_users * 100 / total_users, num_users, - total_users)); - } - - if (group_hwm != -1) { - int num_groups = group_hwm - server_state.gid_low; - int total_groups = - server_state.gid_high - server_state.gid_low; - - DEBUG(DUMP_INFO, - ("\tGroup id range is %d%% full (%d of %d)\n", - num_groups * 100 / total_groups, num_groups, - total_groups)); - } - - /* Display complete mapping of users and groups to rids */ -} - -struct winbindd_idmap_methods tdb_idmap_methods = { - tdb_idmap_init, - - tdb_get_sid_from_uid, - tdb_get_sid_from_gid, - - tdb_get_uid_from_sid, - tdb_get_gid_from_sid, - - tdb_idmap_close, - - tdb_idmap_status -}; - -BOOL winbind_idmap_reg_tdb(struct winbindd_idmap_methods **meth) -{ - *meth = &tdb_idmap_methods; - - return True; -} diff --git a/source/nsswitch/winbindd_passdb.c b/source/nsswitch/winbindd_passdb.c deleted file mode 100644 index 401662b6a79..00000000000 --- a/source/nsswitch/winbindd_passdb.c +++ /dev/null @@ -1,360 +0,0 @@ -/* - Unix SMB/CIFS implementation. - - Winbind rpc backend functions - - Copyright (C) Tim Potter 2000-2001,2003 - Copyright (C) Simo Sorce 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 "winbindd.h" - -#undef DBGC_CLASS -#define DBGC_CLASS DBGC_WINBIND - - -/* Query display info for a domain. This returns enough information plus a - bit extra to give an overview of domain users for the User Manager - application. */ -static NTSTATUS query_user_list(struct winbindd_domain *domain, - TALLOC_CTX *mem_ctx, - uint32 *num_entries, - WINBIND_USERINFO **info) -{ - SAM_ACCOUNT *sam_account = NULL; - NTSTATUS result; - uint32 i; - - DEBUG(3,("pdb: query_user_list\n")); - - if (!NT_STATUS_IS_OK(result = pdb_init_sam(&sam_account))) { - return result; - } - - i = 0; - *info = NULL; - - if (pdb_setsampwent(False)) { - - while (pdb_getsampwent(sam_account)) { - - /* we return only nua accounts, or we will have duplicates */ - if (!idmap_check_sid_is_in_free_range(pdb_get_user_sid(sam_account))) { - continue; - } - - *info = talloc_realloc(mem_ctx, *info, (i + 1) * sizeof(WINBIND_USERINFO)); - if (!(*info)) { - DEBUG(0,("query_user_list: out of memory!\n")); - result = NT_STATUS_NO_MEMORY; - break; - } - - (*info)[i].user_sid = talloc(mem_ctx, sizeof(DOM_SID)); - (*info)[i].group_sid = talloc(mem_ctx, sizeof(DOM_SID)); - if (!((*info)[i].user_sid) || !((*info)[i].group_sid)) { - DEBUG(0,("query_user_list: out of memory!\n")); - result = NT_STATUS_NO_MEMORY; - break; - } - sid_copy((*info)[i].user_sid, pdb_get_user_sid(sam_account)); - sid_copy((*info)[i].group_sid, pdb_get_group_sid(sam_account)); - - (*info)[i].acct_name = talloc_strdup(mem_ctx, pdb_get_username(sam_account)); - (*info)[i].full_name = talloc_strdup(mem_ctx, pdb_get_fullname(sam_account)); - if (!((*info)[i].acct_name) || !((*info)[i].full_name)) { - DEBUG(0,("query_user_list: out of memory!\n")); - result = NT_STATUS_NO_MEMORY; - break; - } - - i++; - - if (!NT_STATUS_IS_OK(pdb_reset_sam(sam_account))) { - result = NT_STATUS_UNSUCCESSFUL; - break; - } - } - - *num_entries = i; - result = NT_STATUS_OK; - - } else { - result = NT_STATUS_UNSUCCESSFUL; - } - - pdb_free_sam(&sam_account); - return result; -} - -/* list all domain groups */ -static NTSTATUS enum_dom_groups(struct winbindd_domain *domain, - TALLOC_CTX *mem_ctx, - uint32 *num_entries, - struct acct_info **info) -{ - NTSTATUS result = NT_STATUS_OK; - - DEBUG(3,("pdb: enum_dom_groups (group support not implemented)\n")); - - *num_entries = 0; - *info = 0; - - return result; -} - -/* List all domain groups */ - -static NTSTATUS enum_local_groups(struct winbindd_domain *domain, - TALLOC_CTX *mem_ctx, - uint32 *num_entries, - struct acct_info **info) -{ - NTSTATUS result = NT_STATUS_OK; - - DEBUG(3,("pdb: enum_local_groups (group support not implemented)\n")); - - *num_entries = 0; - *info = 0; - - return result; -} - -/* convert a single name to a sid in a domain */ -static NTSTATUS name_to_sid(struct winbindd_domain *domain, - TALLOC_CTX *mem_ctx, - const char *name, - DOM_SID *sid, - enum SID_NAME_USE *type) -{ - SAM_ACCOUNT *sam_account = NULL; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(3,("pdb: name_to_sid name=%s (group support not implemented)\n", name)); - - if (NT_STATUS_IS_OK(pdb_init_sam(&sam_account))) { - if (!pdb_getsampwnam(sam_account, name)) { - result = NT_STATUS_UNSUCCESSFUL; - } else { /* it is a sam user */ - sid_copy(sid, pdb_get_user_sid(sam_account)); - *type = SID_NAME_USER; - result = NT_STATUS_OK; - } - } - - pdb_free_sam(&sam_account); - return result; -} - -/* - convert a domain SID to a user or group name -*/ -static NTSTATUS sid_to_name(struct winbindd_domain *domain, - TALLOC_CTX *mem_ctx, - DOM_SID *sid, - char **name, - enum SID_NAME_USE *type) -{ - SAM_ACCOUNT *sam_account = NULL; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - uint32 id; - - DEBUG(3,("pdb: sid_to_name sid=%s\n", sid_string_static(sid))); - - if (NT_STATUS_IS_OK(sid_to_uid(sid, &id))) { /* this is a user */ - - if (!NT_STATUS_IS_OK(result = pdb_init_sam(&sam_account))) { - return result; - } - - if (!pdb_getsampwsid(sam_account, sid)) { - pdb_free_sam(&sam_account); - return NT_STATUS_UNSUCCESSFUL; - } - - *name = talloc_strdup(mem_ctx, pdb_get_username(sam_account)); - if (!(*name)) { - DEBUG(0,("query_user: out of memory!\n")); - pdb_free_sam(&sam_account); - return NT_STATUS_NO_MEMORY; - } - - pdb_free_sam(&sam_account); - *type = SID_NAME_USER; - result = NT_STATUS_OK; - - } else if (NT_STATUS_IS_OK(sid_to_gid(sid, &id))) { /* this is a group */ - - DEBUG(3,("pdb: sid_to_name: group support not implemented\n")); - result = NT_STATUS_UNSUCCESSFUL; - } - - return result; -} - -/* Lookup user information from a rid or username. */ -static NTSTATUS query_user(struct winbindd_domain *domain, - TALLOC_CTX *mem_ctx, - DOM_SID *user_sid, - WINBIND_USERINFO *user_info) -{ - SAM_ACCOUNT *sam_account = NULL; - NTSTATUS result; - - DEBUG(3,("pdb: query_user sid=%s\n", sid_string_static(user_sid))); - - if (!NT_STATUS_IS_OK(result = pdb_init_sam(&sam_account))) { - return result; - } - - if (!pdb_getsampwsid(sam_account, user_sid)) { - pdb_free_sam(&sam_account); - return NT_STATUS_UNSUCCESSFUL; - } - - /* we return only nua accounts, or we will have duplicates */ - if (!idmap_check_sid_is_in_free_range(user_sid)) { - pdb_free_sam(&sam_account); - return NT_STATUS_UNSUCCESSFUL; - } - - user_info->user_sid = talloc(mem_ctx, sizeof(DOM_SID)); - user_info->group_sid = talloc(mem_ctx, sizeof(DOM_SID)); - if (!(user_info->user_sid) || !(user_info->group_sid)) { - DEBUG(0,("query_user: out of memory!\n")); - pdb_free_sam(&sam_account); - return NT_STATUS_NO_MEMORY; - } - sid_copy(user_info->user_sid, pdb_get_user_sid(sam_account)); - sid_copy(user_info->group_sid, pdb_get_group_sid(sam_account)); - - user_info->acct_name = talloc_strdup(mem_ctx, pdb_get_username(sam_account)); - user_info->full_name = talloc_strdup(mem_ctx, pdb_get_fullname(sam_account)); - if (!(user_info->acct_name) || !(user_info->full_name)) { - DEBUG(0,("query_user: out of memory!\n")); - pdb_free_sam(&sam_account); - return NT_STATUS_NO_MEMORY; - } - - pdb_free_sam(&sam_account); - return NT_STATUS_OK; -} - -/* Lookup groups a user is a member of. I wish Unix had a call like this! */ -static NTSTATUS lookup_usergroups(struct winbindd_domain *domain, - TALLOC_CTX *mem_ctx, - DOM_SID *user_sid, - uint32 *num_groups, DOM_SID ***user_gids) -{ - NTSTATUS result = NT_STATUS_OK; - - DEBUG(3,("pdb: lookup_usergroups (group support not implemented)\n")); - - num_groups = 0; - user_gids = 0; - - return result; -} - - -/* Lookup group membership given a rid. */ -static NTSTATUS lookup_groupmem(struct winbindd_domain *domain, - TALLOC_CTX *mem_ctx, - DOM_SID *group_sid, uint32 *num_names, - DOM_SID ***sid_mem, char ***names, - uint32 **name_types) -{ - NTSTATUS result = NT_STATUS_NOT_IMPLEMENTED; - - DEBUG(3,("pdb: lookup_groupmem (group support not implemented)\n")); - - num_names = 0; - sid_mem = 0; - names = 0; - name_types = 0; - - return result; -} - -/* find the sequence number for a domain */ -static NTSTATUS sequence_number(struct winbindd_domain *domain, uint32 *seq) -{ - /* FIXME: we fake up the seq_num untill our passdb support it */ - static uint32 seq_num; - - DEBUG(3,("pdb: sequence_number\n")); - - *seq = seq_num++; - - return NT_STATUS_OK; -} - -/* get a list of trusted domains */ -static NTSTATUS trusted_domains(struct winbindd_domain *domain, - TALLOC_CTX *mem_ctx, - uint32 *num_domains, - char ***names, - char ***alt_names, - DOM_SID **dom_sids) -{ - NTSTATUS result = NT_STATUS_NOT_IMPLEMENTED; - - DEBUG(3,("pdb: trusted_domains (todo!)\n")); - - return result; -} - -/* find the domain sid for a domain */ -static NTSTATUS domain_sid(struct winbindd_domain *domain, DOM_SID *sid) -{ - DEBUG(3,("pdb: domain_sid\n")); - - if (strcmp(domain->name, lp_workgroup())) { - return NT_STATUS_INVALID_PARAMETER; - } else { - sid_copy(sid, get_global_sam_sid()); - return NT_STATUS_OK; - } -} - -/* find alternate names list for the domain - * should we look for netbios aliases?? - SSS */ -static NTSTATUS alternate_name(struct winbindd_domain *domain) -{ - DEBUG(3,("pdb: alternate_name\n")); - - return NT_STATUS_OK; -} - - -/* the rpc backend methods are exposed via this structure */ -struct winbindd_methods passdb_methods = { - False, - query_user_list, - enum_dom_groups, - enum_local_groups, - name_to_sid, - sid_to_name, - query_user, - lookup_usergroups, - lookup_groupmem, - sequence_number, - trusted_domains, - domain_sid, - alternate_name -}; diff --git a/source/pam_smbpass/.cvsignore b/source/pam_smbpass/.cvsignore new file mode 100644 index 00000000000..6d609cec52b --- /dev/null +++ b/source/pam_smbpass/.cvsignore @@ -0,0 +1 @@ +*.po diff --git a/source/sam/idmap_winbind.c b/source/sam/idmap_winbind.c deleted file mode 100644 index 159071e292d..00000000000 --- a/source/sam/idmap_winbind.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - Unix SMB/CIFS implementation. - - idmap Winbind backend - - Copyright (C) Simo Sorce 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" -#include "nsswitch/winbind_nss.h" - -#undef DBGC_CLASS -#define DBGC_CLASS DBGC_IDMAP - -extern DOM_SID global_sid_NULL; /* NULL sid */ - -NSS_STATUS winbindd_request(int req_type, - struct winbindd_request *request, - struct winbindd_response *response); - -/* Get a sid from an id */ -static NTSTATUS db_get_sid_from_id(DOM_SID *sid, unid_t id, int id_type) -{ - struct winbindd_request request; - struct winbindd_response response; - int result, operation; - - ZERO_STRUCT(request); - ZERO_STRUCT(response); - - switch (id_type & ID_TYPEMASK) { - case ID_USERID: - request.data.uid = id.uid; - operation = WINBINDD_UID_TO_SID; - DEBUG(10,("db_get_sid_from_id: asking winbindd uid %u -> sid\n", - (unsigned int)id.uid )); - break; - case ID_GROUPID: - request.data.gid = id.gid; - operation = WINBINDD_GID_TO_SID; - DEBUG(10,("db_get_sid_from_id: asking winbindd gid %u -> sid\n", - (unsigned int)id.gid )); - break; - default: - return NT_STATUS_INVALID_PARAMETER; - } - - /* Make The Request */ - result = winbindd_request(operation, &request, &response); - if (result == NSS_STATUS_SUCCESS) { - DEBUG(10,("db_get_sid_from_id: winbindd replied ok (%s)\n", response.data.sid.sid )); - if (!string_to_sid(sid, response.data.sid.sid)) { - return NT_STATUS_INVALID_SID; - } - return NT_STATUS_OK; - } else { - sid_copy(sid, &global_sid_NULL); - } - - DEBUG(10,("db_get_sid_from_id: winbindd lookup fail\n")); - - return NT_STATUS_UNSUCCESSFUL; -} - -/* Get an id from a sid */ -static NTSTATUS db_get_id_from_sid(unid_t *id, int *id_type, const DOM_SID *sid) -{ - struct winbindd_request request; - struct winbindd_response response; - int result, operation; - fstring sid_str; - - if (!id || !id_type) { - return NT_STATUS_INVALID_PARAMETER; - } - - /* setup request */ - - ZERO_STRUCT(request); - ZERO_STRUCT(response); - - sid_to_string(sid_str, sid); - fstrcpy(request.data.sid, sid_str); - - switch (*id_type & ID_TYPEMASK) { - case ID_USERID: - operation = WINBINDD_SID_TO_UID; - DEBUG(10,("db_get_id_from_sid: asking winbindd %s -> uid\n", - sid_str )); - break; - case ID_GROUPID: - operation = WINBINDD_SID_TO_GID; - DEBUG(10,("db_get_id_from_sid: asking winbindd %s -> gid\n", - sid_str )); - break; - default: - return NT_STATUS_INVALID_PARAMETER; - } - - /* Make The Request */ - result = winbindd_request(operation, &request, &response); - - if (result == NSS_STATUS_SUCCESS) { - if (operation == WINBINDD_SID_TO_UID) { - (*id).uid = response.data.uid; - DEBUG(10,("db_get_id_from_sid: winbindd replied ok (%u)\n", response.data.uid)); - } else { - (*id).gid = response.data.gid; - DEBUG(10,("db_get_id_from_sid: winbindd replied ok (%u)\n", response.data.gid )); - } - return NT_STATUS_OK; - } - - DEBUG(10,("db_get_id_from_sid: winbindd lookup fail\n")); - - return NT_STATUS_UNSUCCESSFUL; -} - -static NTSTATUS db_set_mapping(const DOM_SID *sid, unid_t id, int id_type) { - return NT_STATUS_UNSUCCESSFUL; -} - -/***************************************************************************** - Initialise idmap database. -*****************************************************************************/ -static NTSTATUS db_init( char *params ) { - return NT_STATUS_OK; -} - -/* Close the tdb */ -static NTSTATUS db_close(void) { - return NT_STATUS_OK; -} - -static void db_status(void) { - return; -} - -static struct idmap_methods winbind_methods = { - db_init, - db_get_sid_from_id, - db_get_id_from_sid, - db_set_mapping, - db_close, - db_status -}; - -NTSTATUS idmap_winbind_init(void) -{ - return smb_register_idmap(SMB_IDMAP_INTERFACE_VERSION, "winbind", &winbind_methods); -} diff --git a/source/script/cvslog.pl b/source/script/cvslog.pl deleted file mode 100755 index f3d020aa722..00000000000 --- a/source/script/cvslog.pl +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/perl -w - -my ( $tag, $filename, $date ); -my ( $tmp, $change_flag ); - -if ( $#ARGV != 2 ) { - - print "Usage: ", $0, " cvstag date file\n"; - exit 1; -} - -$tag = $ARGV[0]; -$date = $ARGV[1]; -$filename = $ARGV[2]; - -print STDERR "$filename\n"; - -open ( CVSLOG, "cvs log -d\"$date\" $filename |" ) || die $!; - -## -## First get the branch revision number -## -undef $revision; -while ( !defined($revision) ) { - if ( eof( \*CVSLOG ) ) { - print STDERR "Premature end of cvs log output!\n"; - exit (1); - } - - $string = <CVSLOG>; - chomp( $string ); - - if ( $string =~ /$tag:/ ) { - ( $tmp, $revision ) = split( /:/, $string ); - $revision =~ s/\s+//g; - $revision =~ s/\.0\./\./g; - } -} - -## -## Setup the beginning of the first record -## -$string = ""; -while ( $string !~ /^-+/ ) { - $string = <CVSLOG>; - exit(0) if ( eof(\*CVSLOG) ); -} - -## -## Loop starting at the revision number for the entry -## - -while ( $string = <CVSLOG> ) { - - ($tmp, $entry_rev) = split( /\s+/, $string ); - if ( equal_revision( $revision, $entry_rev ) ) { - if ( ! defined($change_flag) ) { - print "++++++++++++++++++++++++++++++++++++++++++++++++++\n"; - print "## $filename\n"; - print "++\n"; - $change_flag = 1; - } - - while ( $string !~ /^-+/ && !eof(CVSLOG) ) { - print "$string"; - $string = <CVSLOG>; - } - } - else { - while ( ($string !~ /^-+/) && !eof(CVSLOG) ) { - $string = <CVSLOG>; - } - } -} - -close( CVSLOG ); -exit 0; - -############################################################## -## -sub equal_revision { - my ( $branch, $newfile ) = @_; - my ( $indx ); - my ( @branch_rev, @file_rev ); - - @branch_rev = split( /\./, $branch ); - @file_rev = split( /\./, $newfile ); - - return 0 if ( $#branch_rev != ($#file_rev - 1) ); - - $indx = 0; - while( $indx <= $#branch_rev ) { - if ( $branch_rev[$indx] != $file_rev[$indx] ) { - return 0; - } - $indx++; - } - - return 1; -} - - diff --git a/source/script/find_missing_doc.pl b/source/script/find_missing_doc.pl deleted file mode 100755 index b27a405e4dd..00000000000 --- a/source/script/find_missing_doc.pl +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/perl - -my $doc_file = "/docs/docbook/manpages/smb.conf.5.sgml"; -my $source_file = "/source/param/loadparm.c"; - -my %link,%doc,%param; - -# This one shouldn't be documented at all -$doc{-valid} = "FOUND"; - -$topdir = (shift @ARGV) or $topdir = "."; - -################################################## -# Reading links from manpage - -open(IN,$topdir.$doc_file); - -while(<IN>) { - if( /<listitem><para><link linkend="([^"]*)"><parameter>([^<]*)<\/parameter><\/link><\/para><\/listitem>/g ){ - $link{$2} = $1; - $ref{$1} = $2; - } -} - -close(IN); - -################################################## -# Reading documentation from manpage - -open(IN,$topdir.$doc_file) || die("Can't open $topdir$doc_file"); - -while(<IN>) { - if( /<term><anchor id="([^"]*)"\/>([^<]*?)([ ]*)\(.\)([ ]*)<\/term>/g ) { - $key = $1; - $value = $2; - $doc{$value} = $key; - - # There is a reference to this entry - if($ref{$key} eq $value){ - $ref{$key} = "FOUND"; - } else { - if($ref{$key}) { - print "$key should refer to $value, but refers to " . $ref{$key} . "\n"; - } else { - print "$key should refer to $value, but has no reference!\n"; - } - $ref{$key} = $value; - } - } -} - -close(IN); - -################################################# -# Reading entries from source code - -open(SOURCE,$topdir.$source_file) || die("Can't open $topdir$source_file"); - -while ($ln = <SOURCE>) { - last if $ln =~ m/^static\ struct\ parm_struct\ parm_table.*/; -} #burn through the preceding lines - -while ($ln = <SOURCE>) { - last if $ln =~ m/^\s*\}\;\s*$/; - #pull in the param names only - next if $ln =~ m/.*P_SEPARATOR.*/; - next unless $ln =~ /.*\"(.*)\".*/; - - if($doc{lc($1)}) { - $doc{lc($1)} = "FOUND"; - } else { - print "$1 is not documented!\n"; - } -} -close SOURCE; - -################################################## -# Trying to find missing references - -foreach (keys %ref) { - if($ref{$_} cmp "FOUND") { - print "$_ references to " . $ref{$_} . ", but " . $ref{$_} . " isn't an anchor!\n"; - } -} - -foreach (keys %doc) { - if($doc{$_} cmp "FOUND") { - print "$_ is documented but is not a configuration option!\n"; - } -} |