diff options
| author | Noriko Hosoi <nhosoi@redhat.com> | 2007-04-27 21:45:14 +0000 |
|---|---|---|
| committer | Noriko Hosoi <nhosoi@redhat.com> | 2007-04-27 21:45:14 +0000 |
| commit | cdaf25f0089623a6bf277db47ca35011cf8c6a77 (patch) | |
| tree | d920e26d1f41100f6b6fd4f8b93349d92e62ea2e | |
| parent | 1d881ef7b19acd6c4f3f5916f5c8b59c842e4c20 (diff) | |
Resolves: #237356
Summary: Move DS Admin Code into Admin Server (Comment #2)
Description: Cleaning up unused code
26 files changed, 0 insertions, 4446 deletions
diff --git a/config/.cvsignore b/config/.cvsignore deleted file mode 100644 index 9a1527d0..00000000 --- a/config/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -nfspwd -nsinstall -revdepth -myconfig.mk -myrules.mk diff --git a/config/Makefile b/config/Makefile deleted file mode 100644 index 1a73193a..00000000 --- a/config/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -# -# BEGIN COPYRIGHT BLOCK -# 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; version 2 of the License. -# -# 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. -# -# In addition, as a special exception, Red Hat, Inc. gives You the additional -# right to link the code of this Program with code not covered under the GNU -# General Public License ("Non-GPL Code") and to distribute linked combinations -# including the two, subject to the limitations in this paragraph. Non-GPL Code -# permitted under this exception must only link to the code of this Program -# through those well defined interfaces identified in the file named EXCEPTION -# found in the source code files (the "Approved Interfaces"). The files of -# Non-GPL Code may instantiate templates or use macros or inline functions from -# the Approved Interfaces without causing the resulting work to be covered by -# the GNU General Public License. Only Red Hat, Inc. may make changes or -# additions to the list of Approved Interfaces. You must obey the GNU General -# Public License in all respects for all of the Program code and other code used -# in conjunction with the Program except the Non-GPL Code covered by this -# exception. If you modify this file, you may extend this exception to your -# version of the file, but you are not obligated to do so. If you do not wish to -# provide this exception without modification, you must delete this exception -# statement from your version and license this file solely under the GPL without -# exception. -# -# -# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. -# Copyright (C) 2005 Red Hat, Inc. -# All rights reserved. -# END COPYRIGHT BLOCK -# -#! gmake - -DEPTH = .. - -HSRCS = pathsub.h -CSRCS = nsinstall.c pathsub.c - -PLSRCS = nfspwd.pl revdepth.pl - -ifneq ($(subst /,_,$(shell uname -s)),WINNT) -PROGRAM = nsinstall -OBJS = $(CSRCS:.c=.o) -endif - -TARGETS = $(PROGRAM) $(PLSRCS:.pl=) - -# IMPORTANT: Disable NSBUILDROOT for this directory only, otherwise we have -# a recursive rule for finding nsinstall and the perl scripts -ifdef NSBUILDROOT -override NSBUILDROOT := -endif - -include $(DEPTH)/config/rules.mk - -# Redefine MAKE_OBJDIR for just this directory -define MAKE_OBJDIR -if test ! -d $(@D); then rm -rf $(@D); mkdir $(@D); fi -endef - -export:: $(TARGETS) -install:: $(TARGETS) diff --git a/config/common.mn b/config/common.mn deleted file mode 100644 index 38a92b1e..00000000 --- a/config/common.mn +++ /dev/null @@ -1,152 +0,0 @@ -# -# BEGIN COPYRIGHT BLOCK -# 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; version 2 of the License. -# -# 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. -# -# In addition, as a special exception, Red Hat, Inc. gives You the additional -# right to link the code of this Program with code not covered under the GNU -# General Public License ("Non-GPL Code") and to distribute linked combinations -# including the two, subject to the limitations in this paragraph. Non-GPL Code -# permitted under this exception must only link to the code of this Program -# through those well defined interfaces identified in the file named EXCEPTION -# found in the source code files (the "Approved Interfaces"). The files of -# Non-GPL Code may instantiate templates or use macros or inline functions from -# the Approved Interfaces without causing the resulting work to be covered by -# the GNU General Public License. Only Red Hat, Inc. may make changes or -# additions to the list of Approved Interfaces. You must obey the GNU General -# Public License in all respects for all of the Program code and other code used -# in conjunction with the Program except the Non-GPL Code covered by this -# exception. If you modify this file, you may extend this exception to your -# version of the file, but you are not obligated to do so. If you do not wish to -# provide this exception without modification, you must delete this exception -# statement from your version and license this file solely under the GPL without -# exception. -# -# -# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. -# Copyright (C) 2005 Red Hat, Inc. -# All rights reserved. -# END COPYRIGHT BLOCK -# -###################################################################### -### Comon Manifest File -### Cross-platform defines used on all platforms (in theory) -###################################################################### - -# The VERSION_NUMBER is suffixed onto the end of the DLLs we ship. -# Since the longest of these is 5 characters without the suffix, -# be sure to not set VERSION_NUMBER to anything longer than 3 -# characters for Win16's sake. -# -# Also... If you change this value, there are several other places -# you'll need to change (because they're not reached by this -# variable): -# sun-java/nsjava/nsjava32.def -# sun-java/nsjava/nsjava16.def -# sun-java/classsrc/sun/audio/AudioDevice.java -# sun-java/classsrc/sun/awt/windows/WToolkit.java - -VERSION_NUMBER = 40 - -ZIP_NAME = java_$(VERSION_NUMBER) -JAR_NAME = java_$(VERSION_NUMBER).jar - -###################################################################### -### Cross-Platform Java Stuff -###################################################################### -## java interpreter - -# get class files from the directory they are compiled to -JAVA_CLASSPATH = $(JAVA_DESTPATH) - -JAVA_FLAGS = -classpath $(JAVA_CLASSPATH) -ms8m -JAVA = $(JAVA_PROG) $(JAVA_FLAGS) - -JAVA_DEFINES = \ - -DZIP_NAME=\"$(ZIP_NAME)\" \ - -DJAR_NAME=\"$(JAR_NAME)\" \ - -DJRTDLL=\"$(JRTDLL)\" \ - -DMMDLL=\"$(MMDLL)\" \ - -DAWTDLL=\"$(AWTDLL)\" \ - -DJITDLL=\"$(JITDLL)\" - -###################################################################### -## javac - -# to run the compiler in the interpreter -JAVAC_PROG = -ms8m -classpath $(JAVAC_ZIP) sun.tools.javac.Main -JAVAC = $(JAVA_PROG) $(JAVAC_PROG) $(JAVAC_FLAGS) - -# std set of options passed to the compiler -JAVAC_FLAGS = -classpath $(JAVAC_CLASSPATH) $(JAVA_OPTIMIZER) -d $(JAVA_DESTPATH) - -## -## The canonical Java classpath is: -## JAVA_DESTPATH, JAVA_SOURCEPATH, JAVA_LIBS -## -## appropriately delimited, in that order -## -JAVAC_CLASSPATH = $(JAVA_DESTPATH)$(PATH_SEPARATOR)$(JAVA_SOURCEPATH) - -###################################################################### -## javadoc - -# Rules to build java .html files from java source files - -JAVADOC_PROG = $(JAVA) sun.tools.javadoc.Main -JAVADOC_FLAGS = -classpath $(JAVAC_CLASSPATH) -JAVADOC = $(JAVADOC_PROG) $(JAVADOC_FLAGS) - -###################################################################### -## javah - -JAVAH_FLAGS = -classpath $(JAVA_CLASSPATH) -JAVAH = $(JAVAH_PROG) $(JAVAH_FLAGS) - -###################################################################### -## jmc - -JMCSRCDIR = $(XPDIST)/_jmc -JMC_PROG = $(JAVA) netscape.tools.jmc.Main -JMC_CLASSPATH = $(JMCSRCDIR)$(PATH_SEPARATOR)$(JAVAC_CLASSPATH) -JMC_FLAGS = -classpath $(JMC_CLASSPATH) -verbose -JMC = $(JMC_PROG) $(JMC_FLAGS) - -###################################################################### -## zip - -ZIP = $(ZIP_PROG) $(ZIP_FLAGS) - -###################################################################### -## idl2java - -ORBTOOLS = $(DEPTH)/modules/iiop/tools/orbtools.zip -ORB_CLASSPATH = $(ORBTOOLS)$(PATH_SEPARATOR)$(JAVA_CLASSPATH) - -IDL2JAVA_PROG = $(JAVA_PROG) -IDL2JAVA_FLAGS = -classpath $(ORB_CLASSPATH) pomoco.tools.idl2java -IDL2JAVA = $(IDL2JAVA_PROG) $(IDL2JAVA_FLAGS) - -###################################################################### -## lex and yacc - -JAVALEX_PROG = $(JAVA_PROG) -classpath $(ORB_CLASSPATH) sbktech.tools.jax.driver -JAVALEX_FLAGS = -JAVALEX = $(JAVALEX_PROG) $(JAVALEX_FLAGS) - -JAVACUP_PROG = $(JAVA_PROG) -classpath $(ORB_CLASSPATH) java_cup.Main -JAVACUP_FLAGS = -JAVACUP = $(JAVACUP_PROG) $(JAVACUP_FLAGS) - -###################################################################### - - diff --git a/config/nfspwd.pl b/config/nfspwd.pl deleted file mode 100644 index f1878163..00000000 --- a/config/nfspwd.pl +++ /dev/null @@ -1,53 +0,0 @@ -#! /usr/local/bin/perl -# -# BEGIN COPYRIGHT BLOCK -# 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; version 2 of the License. -# -# 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. -# -# In addition, as a special exception, Red Hat, Inc. gives You the additional -# right to link the code of this Program with code not covered under the GNU -# General Public License ("Non-GPL Code") and to distribute linked combinations -# including the two, subject to the limitations in this paragraph. Non-GPL Code -# permitted under this exception must only link to the code of this Program -# through those well defined interfaces identified in the file named EXCEPTION -# found in the source code files (the "Approved Interfaces"). The files of -# Non-GPL Code may instantiate templates or use macros or inline functions from -# the Approved Interfaces without causing the resulting work to be covered by -# the GNU General Public License. Only Red Hat, Inc. may make changes or -# additions to the list of Approved Interfaces. You must obey the GNU General -# Public License in all respects for all of the Program code and other code used -# in conjunction with the Program except the Non-GPL Code covered by this -# exception. If you modify this file, you may extend this exception to your -# version of the file, but you are not obligated to do so. If you do not wish to -# provide this exception without modification, you must delete this exception -# statement from your version and license this file solely under the GPL without -# exception. -# -# -# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. -# Copyright (C) 2005 Red Hat, Inc. -# All rights reserved. -# END COPYRIGHT BLOCK -# - -require "fastcwd.pl"; - -$_ = &fastcwd; -if (m@^/[uh]/@o || s@^/tmp_mnt/@/@o) { - print("$_\n"); -} elsif ((($user, $rest) = m@^/usr/people/(\w+)/(.*)@o) - && readlink("/u/$user") eq "/usr/people/$user") { - print("/u/$user/$rest\n"); -} else { - chop($host = `hostname`); - print("/h/$host$_\n"); -} diff --git a/config/nsinstall.c b/config/nsinstall.c deleted file mode 100644 index 12f43a99..00000000 --- a/config/nsinstall.c +++ /dev/null @@ -1,342 +0,0 @@ -/** BEGIN COPYRIGHT BLOCK - * 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; version 2 of the License. - * - * 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. - * - * In addition, as a special exception, Red Hat, Inc. gives You the additional - * right to link the code of this Program with code not covered under the GNU - * General Public License ("Non-GPL Code") and to distribute linked combinations - * including the two, subject to the limitations in this paragraph. Non-GPL Code - * permitted under this exception must only link to the code of this Program - * through those well defined interfaces identified in the file named EXCEPTION - * found in the source code files (the "Approved Interfaces"). The files of - * Non-GPL Code may instantiate templates or use macros or inline functions from - * the Approved Interfaces without causing the resulting work to be covered by - * the GNU General Public License. Only Red Hat, Inc. may make changes or - * additions to the list of Approved Interfaces. You must obey the GNU General - * Public License in all respects for all of the Program code and other code used - * in conjunction with the Program except the Non-GPL Code covered by this - * exception. If you modify this file, you may extend this exception to your - * version of the file, but you are not obligated to do so. If you do not wish to - * provide this exception without modification, you must delete this exception - * statement from your version and license this file solely under the GPL without - * exception. - * - * - * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. - * All rights reserved. - * END COPYRIGHT BLOCK **/ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -/* -** install command. -** -** Brendan Eich, 7/20/95 -*/ -#include <stdio.h> /* OSF/1 requires this before grp.h, so put it first */ -#include <assert.h> -#include <fcntl.h> -#include <grp.h> -#include <pwd.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <utime.h> -#include <sys/types.h> -#include <sys/stat.h> -#include "pathsub.h" - -#define HAVE_LCHOWN - -#if defined(AIXV3) || defined(BSDI) || defined(HPUX) || defined(LINUX) || defined(SUNOS4) || defined(SCO) || defined(SNI) -#undef HAVE_LCHOWN -#endif - -#ifdef LINUX -# include <getopt.h> -#endif - -#if defined(SCO) || defined(UNIXWARE) || defined(SNI) || defined (NCR) || defined(UnixWare) -#if !defined(S_ISLNK) && defined(S_IFLNK) -#define S_ISLNK(a) (((a) & S_IFMT) == S_IFLNK) -#endif -#endif - -static void -usage(void) -{ - fprintf(stderr, - "usage: %s [-C cwd] [-L linkprefix] [-m mode] [-o owner] [-g group]\n" - " %*s [-DdltR] file [file ...] directory\n", - program, strlen(program), ""); - exit(2); -} - -static int -mkdirs(char *path, mode_t mode) -{ - char *cp; - struct stat sb; - - while (*path == '/' && path[1] == '/') - path++; - while ((cp = strrchr(path, '/')) && cp[1] == '\0') - *cp = '\0'; - if (cp && cp != path) { - *cp = '\0'; - if ((lstat(path, &sb) < 0 || !S_ISDIR(sb.st_mode)) && - mkdirs(path, mode) < 0) { - return -1; - } - *cp = '/'; - } - return mkdir(path, mode); -} - -static uid_t -touid(char *owner) -{ - struct passwd *pw; - uid_t uid; - char *cp; - - pw = getpwnam(owner); - if (pw) - return pw->pw_uid; - uid = strtol(owner, &cp, 0); - if (uid == 0 && cp == owner) - fail("cannot find uid for %s", owner); - return uid; -} - -static gid_t -togid(char *group) -{ - struct group *gr; - gid_t gid; - char *cp; - - gr = getgrnam(group); - if (gr) - return gr->gr_gid; - gid = strtol(group, &cp, 0); - if (gid == 0 && cp == group) - fail("cannot find gid for %s", group); - return gid; -} - -int -main(int argc, char **argv) -{ - int onlydir, dodir, dolink, dorelsymlink, dotimes; - mode_t mode; - char *linkprefix, *owner, *group; - int opt, len, lplen, tdlen, bnlen, exists, fromfd, tofd, cc, wc; - char *cp, *cwd, *todir, *toname, *name, *base, *linkname; - uid_t uid; - gid_t gid; - char *bp, buf[BUFSIZ]; - struct stat sb, tosb; - struct utimbuf utb; - - program = argv[0]; - cwd = 0; - onlydir = dodir = dolink = dorelsymlink = dotimes = 0; - mode = 0755; - linkprefix = owner = group = 0; - - while ((opt = getopt(argc, argv, "C:DdlL:Rm:o:g:t")) != EOF) { - switch (opt) { - case 'C': - cwd = optarg; - break; - case 'D': - onlydir = 1; - break; - case 'd': - dodir = 1; - break; - case 'l': - dolink = 1; - break; - case 'L': - linkprefix = optarg; - lplen = strlen(linkprefix); - dolink = 1; - break; - case 'R': - dolink = dorelsymlink = 1; - break; - case 'm': - mode = strtoul(optarg, &cp, 8); - if (mode == 0 && cp == optarg) - usage(); - break; - case 'o': - owner = optarg; - break; - case 'g': - group = optarg; - break; - case 't': - dotimes = 1; - break; - default: - usage(); - } - } - - argc -= optind; - argv += optind; - if (argc < 2 - onlydir) - usage(); - - todir = argv[argc-1]; - if ((stat(todir, &sb) < 0 || !S_ISDIR(sb.st_mode)) && - mkdirs(todir, 0777) < 0) { - fail("cannot make directory %s", todir); - } - if (onlydir) - return 0; - - if (!cwd) - cwd = getcwd(0, PATH_MAX); - xchdir(todir); - todir = getcwd(0, PATH_MAX); - tdlen = strlen(todir); - xchdir(cwd); - tdlen = strlen(todir); - - uid = owner ? touid(owner) : -1; - gid = group ? togid(group) : -1; - - while (--argc > 0) { - name = *argv++; - len = strlen(name); - base = xbasename(name); - bnlen = strlen(base); - toname = xmalloc(tdlen + 1 + bnlen + 1); - sprintf(toname, "%s/%s", todir, base); - exists = (lstat(toname, &tosb) == 0); - - if (dodir) { - /* -d means create a directory, always */ - if (exists && !S_ISDIR(tosb.st_mode)) { - (void) unlink(toname); - exists = 0; - } - if (!exists && mkdir(toname, mode) < 0) - fail("cannot make directory %s", toname); - if ((owner || group) && chown(toname, uid, gid) < 0) - fail("cannot change owner of %s", toname); - } else if (dolink) { - if (*name == '/') { - /* source is absolute pathname, link to it directly */ - linkname = 0; - } else { - if (linkprefix) { - /* -L implies -l and prefixes names with a $cwd arg. */ - len += lplen + 1; - linkname = xmalloc(len + 1); - sprintf(linkname, "%s/%s", linkprefix, name); - } else if (dorelsymlink) { - /* Symlink the relative path from todir to source name. */ - linkname = xmalloc(PATH_MAX); - - if (*todir == '/') { - /* todir is absolute: skip over common prefix. */ - lplen = relatepaths(todir, cwd, linkname); - strcpy(linkname + lplen, name); - } else { - /* todir is named by a relative path: reverse it. */ - reversepath(todir, name, len, linkname); - xchdir(cwd); - } - - len = strlen(linkname); - } - name = linkname; - } - - /* Check for a pre-existing symlink with identical content. */ - if (exists && - (!S_ISLNK(tosb.st_mode) || - readlink(toname, buf, sizeof buf) != len || - strncmp(buf, name, len) != 0)) { - (void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname); - exists = 0; - } - if (!exists && symlink(name, toname) < 0) - fail("cannot make symbolic link %s", toname); -#ifdef HAVE_LCHOWN - if ((owner || group) && lchown(toname, uid, gid) < 0) - fail("cannot change owner of %s", toname); -#endif - - if (linkname) { - free(linkname); - linkname = 0; - } - } else { - /* Copy from name to toname, which might be the same file. */ - fromfd = open(name, O_RDONLY); - if (fromfd < 0 || fstat(fromfd, &sb) < 0) - fail("cannot access %s", name); - if (exists && (!S_ISREG(tosb.st_mode) || access(toname, W_OK) < 0)) - (void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname); - tofd = open(toname, O_CREAT | O_WRONLY, 0666); - if (tofd < 0) - fail("cannot create %s", toname); - - bp = buf; - while ((cc = read(fromfd, bp, sizeof buf)) > 0) { - while ((wc = write(tofd, bp, cc)) > 0) { - if ((cc -= wc) == 0) - break; - bp += wc; - } - if (wc < 0) - fail("cannot write to %s", toname); - } - if (cc < 0) - fail("cannot read from %s", name); - - if (ftruncate(tofd, sb.st_size) < 0) - fail("cannot truncate %s", toname); - if (dotimes) { - utb.actime = sb.st_atime; - utb.modtime = sb.st_mtime; - if (utime(toname, &utb) < 0) - fail("cannot set times of %s", toname); - } - if (fchmod(tofd, mode) < 0) - fail("cannot change mode of %s", toname); - if ((owner || group) && fchown(tofd, uid, gid) < 0) - fail("cannot change owner of %s", toname); - - /* Must check for delayed (NFS) write errors on close. */ - if (close(tofd) < 0) - fail("cannot write to %s", toname); - close(fromfd); - } - - free(toname); - } - - free(cwd); - free(todir); - return 0; -} diff --git a/config/pathsub.c b/config/pathsub.c deleted file mode 100644 index 289fdf35..00000000 --- a/config/pathsub.c +++ /dev/null @@ -1,243 +0,0 @@ -/** BEGIN COPYRIGHT BLOCK - * 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; version 2 of the License. - * - * 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. - * - * In addition, as a special exception, Red Hat, Inc. gives You the additional - * right to link the code of this Program with code not covered under the GNU - * General Public License ("Non-GPL Code") and to distribute linked combinations - * including the two, subject to the limitations in this paragraph. Non-GPL Code - * permitted under this exception must only link to the code of this Program - * through those well defined interfaces identified in the file named EXCEPTION - * found in the source code files (the "Approved Interfaces"). The files of - * Non-GPL Code may instantiate templates or use macros or inline functions from - * the Approved Interfaces without causing the resulting work to be covered by - * the GNU General Public License. Only Red Hat, Inc. may make changes or - * additions to the list of Approved Interfaces. You must obey the GNU General - * Public License in all respects for all of the Program code and other code used - * in conjunction with the Program except the Non-GPL Code covered by this - * exception. If you modify this file, you may extend this exception to your - * version of the file, but you are not obligated to do so. If you do not wish to - * provide this exception without modification, you must delete this exception - * statement from your version and license this file solely under the GPL without - * exception. - * - * - * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. - * All rights reserved. - * END COPYRIGHT BLOCK **/ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -/* -** Pathname subroutines. -** -** Brendan Eich, 8/29/95 -*/ -#include <assert.h> -#include <dirent.h> -#include <errno.h> -#include <stdarg.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include "pathsub.h" -#ifdef USE_REENTRANT_LIBC -#include <libc_r.h> -#endif /* USE_REENTRANT_LIBC */ - -char *program; - -void -fail(char *format, ...) -{ - int error; - va_list ap; - -#ifdef USE_REENTRANT_LIBC - R_STRERROR_INIT_R(); -#endif - - error = errno; - fprintf(stderr, "%s: ", program); - va_start(ap, format); - vfprintf(stderr, format, ap); - va_end(ap); - if (error) - -#ifdef USE_REENTRANT_LIBC - R_STRERROR_R(errno); - fprintf(stderr, ": %s", r_strerror_r); -#else - fprintf(stderr, ": %s", strerror(errno)); -#endif - - putc('\n', stderr); - exit(1); -} - -char * -getcomponent(char *path, char *name) -{ - if (*path == '\0') - return 0; - if (*path == '/') { - *name++ = '/'; - } else { - do { - *name++ = *path++; - } while (*path != '/' && *path != '\0'); - } - *name = '\0'; - while (*path == '/') - path++; - return path; -} - -#ifdef UNIXWARE -/* Sigh. The static buffer in Unixware's readdir is too small. */ -struct dirent * readdir(DIR *d) -{ - static struct dirent *buf = NULL; -#define MAX_PATH_LEN 1024 - - - if(buf == NULL) - buf = (struct dirent *) malloc(sizeof(struct dirent) + MAX_PATH_LEN) -; - return(readdir_r(d, buf)); -} -#endif - -char * -ino2name(ino_t ino, char *dir) -{ - DIR *dp; - struct dirent *ep; - char *name; - - dp = opendir(".."); - if (!dp) - fail("cannot read parent directory"); - for (;;) { - if (!(ep = readdir(dp))) - fail("cannot find current directory"); - if (ep->d_ino == ino) - break; - } - name = xstrdup(ep->d_name); - closedir(dp); - return name; -} - -void * -xmalloc(size_t size) -{ - void *p = malloc(size); - if (!p) - fail("cannot allocate %u bytes", size); - return p; -} - -char * -xstrdup(char *s) -{ - return strcpy(xmalloc(strlen(s) + 1), s); -} - -char * -xbasename(char *path) -{ - char *cp; - - while ((cp = strrchr(path, '/')) && cp[1] == '\0') - *cp = '\0'; - if (!cp) return path; - return cp + 1; -} - -void -xchdir(char *dir) -{ - if (chdir(dir) < 0) - fail("cannot change directory to %s", dir); -} - -int -relatepaths(char *from, char *to, char *outpath) -{ - char *cp, *cp2; - int len; - char buf[NAME_MAX]; - - assert(*from == '/' && *to == '/'); - for (cp = to, cp2 = from; *cp == *cp2; cp++, cp2++) - if (*cp == '\0') - break; - while (cp[-1] != '/') - cp--, cp2--; - if (cp - 1 == to) { - /* closest common ancestor is /, so use full pathname */ - len = strlen(strcpy(outpath, to)); - if (outpath[len] != '/') { - outpath[len++] = '/'; - outpath[len] = '\0'; - } - } else { - len = 0; - while ((cp2 = getcomponent(cp2, buf)) != 0) { - strcpy(outpath + len, "../"); - len += 3; - } - while ((cp = getcomponent(cp, buf)) != 0) { - sprintf(outpath + len, "%s/", buf); - len += strlen(outpath + len); - } - } - return len; -} - -void -reversepath(char *inpath, char *name, int len, char *outpath) -{ - char *cp, *cp2; - char buf[NAME_MAX]; - struct stat sb; - - cp = strcpy(outpath + PATH_MAX - (len + 1), name); - cp2 = inpath; - while ((cp2 = getcomponent(cp2, buf)) != 0) { - if (strcmp(buf, ".") == 0) - continue; - if (strcmp(buf, "..") == 0) { - if (stat(".", &sb) < 0) - fail("cannot stat current directory"); - name = ino2name(sb.st_ino, ".."); - len = strlen(name); - cp -= len + 1; - strcpy(cp, name); - cp[len] = '/'; - free(name); - xchdir(".."); - } else { - cp -= 3; - strncpy(cp, "../", 3); - xchdir(buf); - } - } - strcpy(outpath, cp); -} diff --git a/config/pathsub.h b/config/pathsub.h deleted file mode 100644 index f1c1efbd..00000000 --- a/config/pathsub.h +++ /dev/null @@ -1,88 +0,0 @@ -/** BEGIN COPYRIGHT BLOCK - * 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; version 2 of the License. - * - * 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. - * - * In addition, as a special exception, Red Hat, Inc. gives You the additional - * right to link the code of this Program with code not covered under the GNU - * General Public License ("Non-GPL Code") and to distribute linked combinations - * including the two, subject to the limitations in this paragraph. Non-GPL Code - * permitted under this exception must only link to the code of this Program - * through those well defined interfaces identified in the file named EXCEPTION - * found in the source code files (the "Approved Interfaces"). The files of - * Non-GPL Code may instantiate templates or use macros or inline functions from - * the Approved Interfaces without causing the resulting work to be covered by - * the GNU General Public License. Only Red Hat, Inc. may make changes or - * additions to the list of Approved Interfaces. You must obey the GNU General - * Public License in all respects for all of the Program code and other code used - * in conjunction with the Program except the Non-GPL Code covered by this - * exception. If you modify this file, you may extend this exception to your - * version of the file, but you are not obligated to do so. If you do not wish to - * provide this exception without modification, you must delete this exception - * statement from your version and license this file solely under the GPL without - * exception. - * - * - * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. - * All rights reserved. - * END COPYRIGHT BLOCK **/ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#ifndef pathsub_h___ -#define pathsub_h___ -/* -** Pathname subroutines. -** -** Brendan Eich, 8/29/95 -*/ -#include <limits.h> -#include <sys/types.h> - -#if SUNOS4 -#include "../nspr/include/sunos4.h" -#endif - -#ifndef PATH_MAX -#define PATH_MAX 1024 -#endif - -/* - * Just prevent stupidity - */ -#undef NAME_MAX -#define NAME_MAX 256 - -extern char *program; - -extern void fail(char *format, ...) -#ifdef __GNUC__ - __attribute__ ((format (printf, 1, 2))); -#else - ; -#endif -extern char *getcomponent(char *path, char *name); -extern char *ino2name(ino_t ino, char *dir); -extern void *xmalloc(size_t size); -extern char *xstrdup(char *s); -extern char *xbasename(char *path); -extern void xchdir(char *dir); - -/* Relate absolute pathnames from and to returning the result in outpath. */ -extern int relatepaths(char *from, char *to, char *outpath); - -/* XXX changes current working directory -- caveat emptor */ -extern void reversepath(char *inpath, char *name, int len, char *outpath); - -#endif /* pathsub_h___ */ diff --git a/config/revdepth-nt.pl b/config/revdepth-nt.pl deleted file mode 100644 index 9df9219c..00000000 --- a/config/revdepth-nt.pl +++ /dev/null @@ -1,51 +0,0 @@ -#! /usr/local/bin/perl -# -# BEGIN COPYRIGHT BLOCK -# 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; version 2 of the License. -# -# 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. -# -# In addition, as a special exception, Red Hat, Inc. gives You the additional -# right to link the code of this Program with code not covered under the GNU -# General Public License ("Non-GPL Code") and to distribute linked combinations -# including the two, subject to the limitations in this paragraph. Non-GPL Code -# permitted under this exception must only link to the code of this Program -# through those well defined interfaces identified in the file named EXCEPTION -# found in the source code files (the "Approved Interfaces"). The files of -# Non-GPL Code may instantiate templates or use macros or inline functions from -# the Approved Interfaces without causing the resulting work to be covered by -# the GNU General Public License. Only Red Hat, Inc. may make changes or -# additions to the list of Approved Interfaces. You must obey the GNU General -# Public License in all respects for all of the Program code and other code used -# in conjunction with the Program except the Non-GPL Code covered by this -# exception. If you modify this file, you may extend this exception to your -# version of the file, but you are not obligated to do so. If you do not wish to -# provide this exception without modification, you must delete this exception -# statement from your version and license this file solely under the GPL without -# exception. -# -# -# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. -# Copyright (C) 2005 Red Hat, Inc. -# All rights reserved. -# END COPYRIGHT BLOCK -# - -require "/ns/config/fastcwd.pl"; - -$cur = &fastcwd; -chdir($ARGV[0]); -$newcur = &fastcwd; -$newcurlen = length($newcur); - -# Skip common separating / unless $newcur is "/" -$cur = substr($cur, $newcurlen + ($newcurlen > 1)); -print $cur; diff --git a/config/revdepth.pl b/config/revdepth.pl deleted file mode 100644 index a0ef02fe..00000000 --- a/config/revdepth.pl +++ /dev/null @@ -1,54 +0,0 @@ -#! /usr/local/bin/perl -# -# BEGIN COPYRIGHT BLOCK -# 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; version 2 of the License. -# -# 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. -# -# In addition, as a special exception, Red Hat, Inc. gives You the additional -# right to link the code of this Program with code not covered under the GNU -# General Public License ("Non-GPL Code") and to distribute linked combinations -# including the two, subject to the limitations in this paragraph. Non-GPL Code -# permitted under this exception must only link to the code of this Program -# through those well defined interfaces identified in the file named EXCEPTION -# found in the source code files (the "Approved Interfaces"). The files of -# Non-GPL Code may instantiate templates or use macros or inline functions from -# the Approved Interfaces without causing the resulting work to be covered by -# the GNU General Public License. Only Red Hat, Inc. may make changes or -# additions to the list of Approved Interfaces. You must obey the GNU General -# Public License in all respects for all of the Program code and other code used -# in conjunction with the Program except the Non-GPL Code covered by this -# exception. If you modify this file, you may extend this exception to your -# version of the file, but you are not obligated to do so. If you do not wish to -# provide this exception without modification, you must delete this exception -# statement from your version and license this file solely under the GPL without -# exception. -# -# -# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. -# Copyright (C) 2005 Red Hat, Inc. -# All rights reserved. -# END COPYRIGHT BLOCK -# - -unshift(@INC, '/usr/lib/perl'); -unshift(@INC, '/usr/local/lib/perl'); - -require "fastcwd.pl"; - -$cur = &fastcwd; -chdir($ARGV[0]); -$newcur = &fastcwd; -$newcurlen = length($newcur); - -# Skip common separating / unless $newcur is "/" -$cur = substr($cur, $newcurlen + ($newcurlen > 1)); -print $cur; diff --git a/ldap/admin/src/java/com/netscape/xmltools/DSML2LDIF.java b/ldap/admin/src/java/com/netscape/xmltools/DSML2LDIF.java deleted file mode 100644 index 8b6ac443..00000000 --- a/ldap/admin/src/java/com/netscape/xmltools/DSML2LDIF.java +++ /dev/null @@ -1,266 +0,0 @@ -/** BEGIN COPYRIGHT BLOCK - * 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; version 2 of the License. - * - * 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. - * - * In addition, as a special exception, Red Hat, Inc. gives You the additional - * right to link the code of this Program with code not covered under the GNU - * General Public License ("Non-GPL Code") and to distribute linked combinations - * including the two, subject to the limitations in this paragraph. Non-GPL Code - * permitted under this exception must only link to the code of this Program - * through those well defined interfaces identified in the file named EXCEPTION - * found in the source code files (the "Approved Interfaces"). The files of - * Non-GPL Code may instantiate templates or use macros or inline functions from - * the Approved Interfaces without causing the resulting work to be covered by - * the GNU General Public License. Only Red Hat, Inc. may make changes or - * additions to the list of Approved Interfaces. You must obey the GNU General - * Public License in all respects for all of the Program code and other code used - * in conjunction with the Program except the Non-GPL Code covered by this - * exception. If you modify this file, you may extend this exception to your - * version of the file, but you are not obligated to do so. If you do not wish to - * provide this exception without modification, you must delete this exception - * statement from your version and license this file solely under the GPL without - * exception. - * - * - * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. - * All rights reserved. - * END COPYRIGHT BLOCK **/ - -package com.netscape.xmltools; - -import java.util.*; -import java.io.*; -import org.xml.sax.SAXException; -import netscape.ldap.*; -import netscape.ldap.util.*; - -/** - * Tool for converting DSML document to LDIF document - */ -public class DSML2LDIF { - - /** - * Default no argument constructor. - */ - public DSML2LDIF() { - } - - /** - * Parse the command line parameters and setup the options parameters - */ - static private GetOpt parseParameters( String[] args ) { - - GetOpt options = new GetOpt("H?so:", args); - - if (options.hasOption('H') || options.hasOption('?')) { - usage(); - System.exit(0); - } - - if (options.hasOption('v')) { - m_verbose = true; - } - - if (options.hasOption('o')) { - m_outfile = options.getOptionParam('o'); - if (m_outfile == null) { - System.err.println( "Missing argument for output filename" ); - usage(); - System.exit(0); - } - - try { - m_pw = null; - m_pw = new PrintWriter( new FileOutputStream(m_outfile), true ); - } catch (IOException e) { - System.err.println( "Can't open " + m_outfile ); - System.err.println( e.toString() ); - System.exit(1); - } - } - - Vector extras = options.getParameters(); - if (extras.size() == 1 ) { - m_infile = new String( (String)extras.get(0) ); - } else { - if ( options.hasOption('s') ) { - // Use standard input for input of dsml file - m_infile = null; - } else { - usage(); - System.exit(0); - } - - } - return options; - } - - - /** - * Print out usage of the tool - */ - static private void usage() { - System.err.println("Usage: java [-classpath CLASSPATH] DSML2LDIF infile.dsml -s [-o outfile.ldif]"); - System.err.println("options"); - System.err.println(" -s use standard input for input of dsml file" ); - System.err.println(" -o outfile filename for the output LDIF file" ); - System.err.println(" -H -? for usage" ); - // System.err.println(" -v for verbose mode" ); - } - - static void processEntry( LDAPEntry entry ) { - - long now = 0; - long later = 0; - long writeTime; - if ( m_doProfile ) { - now = System.currentTimeMillis(); - } - try { - if (entry != null) { - m_ldifWriter.printEntry( entry ); - // e = null; - } - if ( m_doProfile ) { - later = System.currentTimeMillis(); - writeTime = later - now; - m_lapWriteTime += writeTime; - now = later; - } - } catch (Exception e) { - ; - } - - if ( m_doProfile ) { - m_entryCount++; - if ( (m_entryCount % LAP_LENGTH) == 0 ) { - System.err.println( m_entryCount + " entries" ); - System.err.println( " " + m_lapWriteTime + - " ms to write" ); - m_lapWriteTime = 0; - System.err.println( " " + (now - m_lapTime) + - " ms total this lap" ); - m_lapTime = now; - } - } - } - - /** - * Temporary class to subclass from LDIFWriter - */ - static class MyLDIFWriter extends netscape.ldap.util.LDIFWriter { - public MyLDIFWriter( PrintWriter pw ) { - super( pw ); - } - - /** - * Print prologue to entry - * - * @param dn the DN of the entry - */ - protected void printEntryStart( String dn ) { - if ( dn == null ) { - dn = ""; - } else { - byte[] b = null; - try { - b = dn.getBytes( "UTF8" ); - } catch ( UnsupportedEncodingException ex ) { - } - if ( !LDIF.isPrintable(b) ) { - dn = getPrintableValue( b ); - printString( "dn" + "::" + " " + dn ); - return; - } - } - printString( "dn" + ":" + " " + dn ); - } - } - - /** - * Main routine for the tool. - */ - public static void main(String[] args) { - - m_verify = Boolean.getBoolean("verify"); - parseParameters( args ); - - DSMLReader reader = null; - - try { - if ( m_infile == null ) { - reader = new DSMLReader(); - } - else { - reader = new DSMLReader( m_infile ); - } - } catch (Exception e) { - System.err.println("Error encountered in input"); - System.err.println(e.toString()); - System.exit(1); - } - - m_ldifWriter = new MyLDIFWriter( m_pw ); - - if (m_verify) { - if (m_pw != null) { - m_pw.close(); - } - System.exit( 0 ); - } - - try { - if ( m_doProfile ) { - m_startTime = System.currentTimeMillis(); - m_lapTime = m_startTime; - } - reader.parseDocument(); - } catch( SAXException e ) { - System.err.println("Error encountered in parsing the DSML document"); - System.err.println(e.getMessage()); - e.printStackTrace(); - System.exit(1); - } catch( Exception e ) { - e.printStackTrace(); - } finally { - if (m_pw != null) { - m_pw.flush(); - m_pw.close(); - } - } - - if ( m_doProfile ) { - System.err.println( - (System.currentTimeMillis() - m_startTime) / 1000 + - " seconds total for " + m_entryCount + " entries" ); - } - - System.exit( 0 ); - } - - static private PrintWriter m_pw = new PrintWriter(System.out, true);; - static private boolean m_verbose = false; - static private String m_outfile = null; - static private String m_infile = null; - static private LDIFWriter m_ldifWriter = null; - static private boolean m_verify = false; - static boolean m_doProfile = Boolean.getBoolean("com.netscape.xmltools.doProfile"); - static long m_startTime; - static long m_toEntryTime = 0; - static long m_writeTime = 0; - static long m_lapTime; - static long m_lapToEntryTime = 0; - static long m_lapWriteTime = 0; - static long m_entryCount; - static final int LAP_LENGTH = 1000; -} diff --git a/ldap/admin/src/java/com/netscape/xmltools/DSMLReader.java b/ldap/admin/src/java/com/netscape/xmltools/DSMLReader.java deleted file mode 100644 index 30af93c7..00000000 --- a/ldap/admin/src/java/com/netscape/xmltools/DSMLReader.java +++ /dev/null @@ -1,79 +0,0 @@ -/** BEGIN COPYRIGHT BLOCK - * 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; version 2 of the License. - * - * 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. - * - * In addition, as a special exception, Red Hat, Inc. gives You the additional - * right to link the code of this Program with code not covered under the GNU - * General Public License ("Non-GPL Code") and to distribute linked combinations - * including the two, subject to the limitations in this paragraph. Non-GPL Code - * permitted under this exception must only link to the code of this Program - * through those well defined interfaces identified in the file named EXCEPTION - * found in the source code files (the "Approved Interfaces"). The files of - * Non-GPL Code may instantiate templates or use macros or inline functions from - * the Approved Interfaces without causing the resulting work to be covered by - * the GNU General Public License. Only Red Hat, Inc. may make changes or - * additions to the list of Approved Interfaces. You must obey the GNU General - * Public License in all respects for all of the Program code and other code used - * in conjunction with the Program except the Non-GPL Code covered by this - * exception. If you modify this file, you may extend this exception to your - * version of the file, but you are not obligated to do so. If you do not wish to - * provide this exception without modification, you must delete this exception - * statement from your version and license this file solely under the GPL without - * exception. - * - * - * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. - * All rights reserved. - * END COPYRIGHT BLOCK **/ - -package com.netscape.xmltools; - -import java.io.*; -import java.util.*; -import org.xml.sax.*; -import netscape.ldap.*; -import netscape.ldap.util.*; - -/** - * Class for reading a DSML document according to the DSML 1.0 spec. - */ -public class DSMLReader { - - /** - * Default no argument constructor - */ - public DSMLReader() throws IOException { - m_ds = new DataInputStream( System.in ); - } - - /** - * Constructor for a dsml reader based on a file - * - * @param filename system-dependent filename - */ - public DSMLReader( String filename ) throws IOException { - m_ds = new DataInputStream( new FileInputStream( filename ) ); - } - - /** - * Parses the input stream as a DSML document - * - * @throws SAXException on parsing errors - */ - public void parseDocument() throws SAXException { - DSMLSAXBuilder builder = new DSMLSAXBuilder(); - builder.parse( new InputSource( m_ds ) ); - } - - private DataInputStream m_ds = null; -} diff --git a/ldap/admin/src/java/com/netscape/xmltools/DSMLSAXBuilder.java b/ldap/admin/src/java/com/netscape/xmltools/DSMLSAXBuilder.java deleted file mode 100644 index 5d0f05f0..00000000 --- a/ldap/admin/src/java/com/netscape/xmltools/DSMLSAXBuilder.java +++ /dev/null @@ -1,118 +0,0 @@ -/** BEGIN COPYRIGHT BLOCK - * 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; version 2 of the License. - * - * 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. - * - * In addition, as a special exception, Red Hat, Inc. gives You the additional - * right to link the code of this Program with code not covered under the GNU - * General Public License ("Non-GPL Code") and to distribute linked combinations - * including the two, subject to the limitations in this paragraph. Non-GPL Code - * permitted under this exception must only link to the code of this Program - * through those well defined interfaces identified in the file named EXCEPTION - * found in the source code files (the "Approved Interfaces"). The files of - * Non-GPL Code may instantiate templates or use macros or inline functions from - * the Approved Interfaces without causing the resulting work to be covered by - * the GNU General Public License. Only Red Hat, Inc. may make changes or - * additions to the list of Approved Interfaces. You must obey the GNU General - * Public License in all respects for all of the Program code and other code used - * in conjunction with the Program except the Non-GPL Code covered by this - * exception. If you modify this file, you may extend this exception to your - * version of the file, but you are not obligated to do so. If you do not wish to - * provide this exception without modification, you must delete this exception - * statement from your version and license this file solely under the GPL without - * exception. - * - * - * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. - * All rights reserved. - * END COPYRIGHT BLOCK **/ -package com.netscape.xmltools; - -import javax.xml.parsers.*; -import org.xml.sax.*; -import org.xml.sax.helpers.*; - -/** - * A skeletal SAX driver, which doesn't create a document. Its content handler - * is a DSMLSAXHandler which creates and dispatches LDAP entries from a - * DSML document on the fly. - */ -public class DSMLSAXBuilder { - - /** - * <p> - * Creates a new DSMLSAXBuilder with parser that will not validate. - * </p> - */ - public DSMLSAXBuilder() { - } - - /** - * <p> - * Creates a new DSMLSAXBuilder which will validate - * according to the given parameter. - * </p> - * - * @param validate <code>boolean</code> indicating if - * validation should occur. - */ - public DSMLSAXBuilder(boolean validate) { - m_validate = validate; - } - - /** - * Processes the supplied input source - * - * @param in <code>InputSource</code> to read from - * @throws SAXException when errors occur in parsing - */ - public void parse(InputSource in) throws SAXException { - DSMLSAXHandler contentHandler = null; - - try { - // Create the parser - SAXParserFactory fac = SAXParserFactory.newInstance(); - fac.setValidating( m_validate ); - - XMLReader parser = fac.newSAXParser().getXMLReader(); - parser.setFeature( "http://xml.org/sax/features/namespaces", - true ); - parser.setFeature( "http://xml.org/sax/features/namespace-prefixes", - true ); - - // Create and configure the content handler - parser.setContentHandler( new DSMLSAXHandler() ); - - // Parse the document - parser.parse( in ); - } catch (Exception e) { - if (e instanceof SAXParseException) { - SAXParseException p = (SAXParseException)e; - String systemId = p.getSystemId(); - if (systemId != null) { - throw new SAXException("Error on line " + - p.getLineNumber() + " of document " - + systemId, e); - } else { - throw new SAXException("Error on line " + - p.getLineNumber(), e); - } - } else if (e instanceof SAXException) { - throw (SAXException)e; - } else { - throw new SAXException("Error in parsing", e); - } - } - } - - private boolean m_validate = false; -} diff --git a/ldap/admin/src/java/com/netscape/xmltools/DSMLSAXHandler.java b/ldap/admin/src/java/com/netscape/xmltools/DSMLSAXHandler.java deleted file mode 100644 index c8250581..00000000 --- a/ldap/admin/src/java/com/netscape/xmltools/DSMLSAXHandler.java +++ /dev/null @@ -1,331 +0,0 @@ -/** BEGIN COPYRIGHT BLOCK - * 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; version 2 of the License. - * - * 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. - * - * In addition, as a special exception, Red Hat, Inc. gives You the additional - * right to link the code of this Program with code not covered under the GNU - * General Public License ("Non-GPL Code") and to distribute linked combinations - * including the two, subject to the limitations in this paragraph. Non-GPL Code - * permitted under this exception must only link to the code of this Program - * through those well defined interfaces identified in the file named EXCEPTION - * found in the source code files (the "Approved Interfaces"). The files of - * Non-GPL Code may instantiate templates or use macros or inline functions from - * the Approved Interfaces without causing the resulting work to be covered by - * the GNU General Public License. Only Red Hat, Inc. may make changes or - * additions to the list of Approved Interfaces. You must obey the GNU General - * Public License in all respects for all of the Program code and other code used - * in conjunction with the Program except the Non-GPL Code covered by this - * exception. If you modify this file, you may extend this exception to your - * version of the file, but you are not obligated to do so. If you do not wish to - * provide this exception without modification, you must delete this exception - * statement from your version and license this file solely under the GPL without - * exception. - * - * - * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. - * All rights reserved. - * END COPYRIGHT BLOCK **/ -package com.netscape.xmltools; - -import java.util.*; - -import org.xml.sax.*; -import org.xml.sax.helpers.*; - -import netscape.ldap.*; -import netscape.ldap.util.*; - -/** - * Content handler which dispatches each LDAP entry composed from a dsml:entry - * element and its children. No document is built. - */ -public class DSMLSAXHandler extends DefaultHandler { - /** The DSML namespace */ - private static final String DSML_NS = "http://www.dsml.org/DSML"; - - /** Element stack */ - private Stack stack = new Stack(); - - /** Whether to ignore ignorable whitespace */ - private boolean ignoringWhite = true; - - /** Keeps track of name spaces */ - private NamespaceSupport namespaces = new NamespaceSupport(); - - /** - * Creates a new <code>SAXHandler</code> that listens to SAX - * events and dispatches LDAP entries as they are found - */ - public DSMLSAXHandler() { - } - - /** - * Returns the value of a particular attribute from an array of - * attributes - * - * @param atts Array of attributes to process - * @param name The name of the attribute to return - * @return The value of the matching attribute, or null if not there - */ - private String findAttribute( Attributes atts, String name ) { - for (int i = 0, len = atts.getLength(); i < len; i++) { - String attLocalName = atts.getLocalName(i); - String attQName = atts.getQName(i); - // Bypass any xmlns attributes which might appear, as we got - // them already in startPrefixMapping(). - - if (attQName.startsWith("xmlns:") || attQName.equals("xmlns")) { - continue; - } - - if ( name.equalsIgnoreCase( attLocalName ) ) { - return atts.getValue(i); - } - } - return null; - } - - /** - * Creates and returns an object corresponding to the element type - * - * @param prefix Namespace - * @param localName Element name without namespace - * @param atts Any attributes of the element - * @return An object corresponding to the element type - */ - private Object getObjectForElement( String prefix, - String localName, - Attributes atts ) { - // Should not assume the "dsml" prefix. Any prefix can - // be mapped to the DSML namespace URI. - String uri = namespaces.getURI( prefix ); - if ( (uri != null) && uri.equalsIgnoreCase( DSML_NS ) ) { - if ( "entry".equalsIgnoreCase( localName ) ) { - String dn = findAttribute( atts, "dn" ); - if ( dn != null ) { - LDAPEntry entry = new LDAPEntry( dn ); - return entry; - } else { - System.err.println( "No DN for entry" ); - } - } else if ( "attr".equalsIgnoreCase( localName ) ) { - String name = findAttribute( atts, "name" ); - if ( name != null ) { - LDAPAttribute attr = new LDAPAttribute( name ); - return attr; - } else { - System.err.println( "No name for attribute" ); - } - } else if ( "objectclass".equalsIgnoreCase( localName ) ) { - LDAPAttribute attr = new LDAPAttribute( "objectclass" ); - return attr; - } else if ( "oc-value".equalsIgnoreCase( localName ) ) { - return new StringAttrValue(); - } else if ( "value".equalsIgnoreCase( localName ) ) { - String enc = findAttribute( atts, "encoding" ); - if ( "Base64".equalsIgnoreCase( enc ) ) { - return new BinaryAttrValue(); - } else { - return new StringAttrValue(); - } - } - } - return null; - } - - - /** - * This reports the occurrence of an actual element. It will include - * the element's attributes, with the exception of XML vocabulary - * specific attributes, such as - * <code>xmlns:[namespace prefix]</code> and - * <code>xsi:schemaLocation</code>. - * - * @param namespaceURI <code>String</code> namespace URI this element - * is associated with, or an empty - * <code>String</code> - * @param localName <code>String</code> name of element (with no - * namespace prefix, if one is present) - * @param qName <code>String</code> XML 1.0 version of element name: - * [namespace prefix]:[localName] - * @param atts <code>Attributes</code> list for this element - * @throws SAXException when things go wrong - */ - public void startElement(String namespaceURI, String localName, - String qName, Attributes atts) - throws SAXException { - Object obj = null; - - int split = qName.indexOf(":"); - String prefix = (split > 0) ? qName.substring(0, split) : null; - if ( prefix != null ) { - // Save the prefix to URI mapping - if ((namespaceURI != null) && (!namespaceURI.equals(""))) { - namespaces.pushContext(); - if ( namespaces.getPrefix( namespaceURI ) == null ) { - namespaces.declarePrefix( prefix, namespaceURI ); - } - } - obj = getObjectForElement( prefix, localName, atts ); - if ( obj instanceof LDAPEntry ) { - m_entry = (LDAPEntry)obj; - } else if ( obj instanceof LDAPAttribute ) { - m_attr = (LDAPAttribute)obj; - } - } else { - // This should never happen - System.err.println( "No namespace for [" + qName + "]" ); - m_entry = null; - m_attr = null; - } - - if ( obj != null ) { - // Put the DSML object on the stack - stack.push(obj); - } - } - - /** - * This will report character data (within an element) - * - * @param ch <code>char[]</code> character array with character data - * @param start <code>int</code> index in array where data starts. - * @param length <code>int</code> length of data. - * @throws SAXException when things go wrong - */ - public void characters(char[] ch, int start, int length) - throws SAXException { - - // Ignore whitespace - boolean empty = true; - int maxOffset = start+length; - for( int i = start; i < maxOffset; i++ ) { - if ( (ch[i] != ' ') && (ch[i] != '\n') ) { - empty = false; - break; - } - } - if ( empty ) { - return; - } - - m_sb.append( ch, start, length ); - } - - /** - * Captures ignorable whitespace as text. If - * setIgnoringElementContentWhitespace(true) has been called then this - * method does nothing. - * - * @param ch <code>[]</code> - char array of ignorable whitespace - * @param start <code>int</code> - starting position within array - * @param length <code>int</code> - length of whitespace after start - * @throws SAXException when things go wrong - */ - public void ignorableWhitespace(char[] ch, int start, int length) - throws SAXException { - if (ignoringWhite) return; - - characters(ch, start, length); - } - - /** - * Takes any action appropriate for a particular object when it has - * been composed from an element and any children - * - * @param obj A DSML object - * @return The updated object - */ - private Object processElementByObject( Object obj ) { - if ( obj instanceof LDAPEntry ) { - // An entry is ready to be processed - LDAPEntry entry = (LDAPEntry)obj; - // Rather than a static method, this should be an object that - // implements an interface and is provided with a setEntryProcessor - // method - DSML2LDIF.processEntry( entry ); - } else if ( obj instanceof StringAttrValue ) { - if ( m_attr == null ) { - // This should never happen - System.err.println( "dsml:value or dsml:oc-value element " + - "not inside dsml:attr or " + - "dsml:objectclass" ); - } else { - String val = new String( m_sb ); - m_attr.addValue( val ); - } - m_sb.setLength( 0 ); - } else if ( obj instanceof BinaryAttrValue ) { - if ( m_attr == null ) { - System.err.println( "dsml:value element not inside dsml:attr" ); - } else { - ByteBuf inBuf = new ByteBuf( new String( m_sb ) ); - ByteBuf decodedBuf = new ByteBuf(); - // Decode base 64 into binary - m_decoder.translate( inBuf, decodedBuf ); - int nBytes = decodedBuf.length(); - if ( nBytes > 0 ) { - String decodedValue = new String(decodedBuf.toBytes(), 0, - nBytes); - m_attr.addValue( decodedValue); - } - } - m_sb.setLength( 0 ); - } else if ( obj instanceof LDAPAttribute ) { - if ( m_entry == null ) { - // This should never happen - System.err.println( "dsml:attr element not inside dsml:entry" ); - } else { - m_entry.getAttributeSet().add( (LDAPAttribute)obj ); - } - m_attr = null; - } - return obj; - } - - /** - * Indicates the end of an element - * (<code></[element name]></code>) is reached. Note that - * the parser does not distinguish between empty - * elements and non-empty elements, so this will occur uniformly. - * - * @param namespaceURI <code>String</code> URI of namespace this - * element is associated with - * @param localName <code>String</code> name of element without prefix - * @param qName <code>String</code> name of element in XML 1.0 form - * @throws SAXException when things go wrong - */ - public void endElement(String namespaceURI, String localName, - String qName) throws SAXException { - if ( !stack.empty() ) { - Object obj = stack.pop(); - - processElementByObject( obj ); - } - - if ((namespaceURI != null) && - (!namespaceURI.equals(""))) { - namespaces.popContext(); - } - } - - private LDAPEntry m_entry = null; - private LDAPAttribute m_attr = null; - private StringBuffer m_sb = new StringBuffer(1024); - static private MimeBase64Decoder m_decoder = new MimeBase64Decoder(); - - class StringAttrValue { - } - class BinaryAttrValue { - } -} diff --git a/ldap/admin/src/java/com/netscape/xmltools/DSMLWriter.java b/ldap/admin/src/java/com/netscape/xmltools/DSMLWriter.java deleted file mode 100644 index ecd3e0b9..00000000 --- a/ldap/admin/src/java/com/netscape/xmltools/DSMLWriter.java +++ /dev/null @@ -1,347 +0,0 @@ -/** BEGIN COPYRIGHT BLOCK - * 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; version 2 of the License. - * - * 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. - * - * In addition, as a special exception, Red Hat, Inc. gives You the additional - * right to link the code of this Program with code not covered under the GNU - * General Public License ("Non-GPL Code") and to distribute linked combinations - * including the two, subject to the limitations in this paragraph. Non-GPL Code - * permitted under this exception must only link to the code of this Program - * through those well defined interfaces identified in the file named EXCEPTION - * found in the source code files (the "Approved Interfaces"). The files of - * Non-GPL Code may instantiate templates or use macros or inline functions from - * the Approved Interfaces without causing the resulting work to be covered by - * the GNU General Public License. Only Red Hat, Inc. may make changes or - * additions to the list of Approved Interfaces. You must obey the GNU General - * Public License in all respects for all of the Program code and other code used - * in conjunction with the Program except the Non-GPL Code covered by this - * exception. If you modify this file, you may extend this exception to your - * version of the file, but you are not obligated to do so. If you do not wish to - * provide this exception without modification, you must delete this exception - * statement from your version and license this file solely under the GPL without - * exception. - * - * - * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. - * All rights reserved. - * END COPYRIGHT BLOCK **/ - -package com.netscape.xmltools; - -import java.util.*; -import netscape.ldap.*; -import java.io.*; -import netscape.ldap.util.*; - -/** - * Class for outputting LDAP entries to a stream as DSML. - * - * @version 1.0 - */ -public class DSMLWriter extends LDAPWriter { - -// static final long serialVersionUID = -2710382547996750924L; - - /** - * Constructs a <CODE>DSMLWriter</CODE> object to output entries - * to a stream as DSML. - * - * @param pw output stream - */ - public DSMLWriter( PrintWriter pw ) { - super( pw ); - } - - /** - * Prints the schema from an entry containing subschema - * - * entry entry containing schema definitions - */ - public void printSchema( LDAPEntry entry ) { - LDAPSchema schema = new LDAPSchema( entry ); - printString( " <dsml:directory-schema>" ); - printObjectClassSchema( schema ); - printAttributeSchema( schema ); - printString( " </dsml:directory-schema>" ); - } - - - /** - * Prints the object class schema from a schema object - * - * schema schema elements - */ - protected void printObjectClassSchema( LDAPSchema schema ) { - Enumeration en = schema.getObjectClasses(); - while( en.hasMoreElements() ) { - LDAPObjectClassSchema s = (LDAPObjectClassSchema)en.nextElement(); - printString( " <dsml:class" ); - printString( " id=\"" + s.getName() + "\"" ); - printString( " oid=\"" + s.getID() + "\"" ); - String[] superiors = s.getSuperiors(); - if ( superiors != null ) { - for( int i = 0; i < superiors.length; i++ ) { - printString( " superior=\"#" + superiors[i] + "\"" ); - } - } - String classType = "structural"; - switch( s.getType() ) { - case LDAPObjectClassSchema.ABSTRACT: classType = "abstract"; - break; - case LDAPObjectClassSchema.AUXILIARY: classType = "auxiliary"; - break; - } - printString( " type=\"" + classType + "\">" ); - if ( s.isObsolete() ) { - printString( " obsolete=true" ); - } - printString( " <dsml:name>" + s.getName() + "</dsml:name>" ); - printString( " <dsml:description>" + s.getDescription() + - "</dsml:description>" ); - Enumeration attrs = s.getRequiredAttributes(); - while( attrs.hasMoreElements() ) { - printString( " <dsml:attribute ref=\"#" + - (String)attrs.nextElement() + - "\" required=\"true\"/>" ); - } - attrs = s.getOptionalAttributes(); - while( attrs.hasMoreElements() ) { - printString( " <dsml:attribute ref=\"#" + - (String)attrs.nextElement() + - "\" required=\"false\"/>" ); - } - printString( " </dsml:class>" ); - } - } - - - /** - * Prints the attribute schema from a schema object - * - * schema schema elements - */ - protected void printAttributeSchema( LDAPSchema schema ) { - Enumeration en = schema.getAttributes(); - while( en.hasMoreElements() ) { - LDAPAttributeSchema s = (LDAPAttributeSchema)en.nextElement(); - printString( " <dsml:attribute-type" ); - printString( " id=\"" + s.getName() + "\"" ); - printString( " oid=\"" + s.getID() + "\"" ); - String superior = s.getSuperior(); - if ( superior != null ) { - printString( " superior=\"#" + superior + "\"" ); - } - if ( s.isSingleValued() ) { - printString( " single-value=true" ); - } - if ( s.isObsolete() ) { - printString( " obsolete=true" ); - } - if ( s.getQualifier( s.NO_USER_MODIFICATION ) != null ) { - printString( " user-modification=false" ); - } - String[] vals = s.getQualifier( s.EQUALITY ); - if ( (vals != null) && (vals.length > 0) ) { - printString( " equality=" + vals[0] ); - } - vals = s.getQualifier( s.ORDERING ); - if ( (vals != null) && (vals.length > 0) ) { - printString( " ordering=" + vals[0] ); - } - vals = s.getQualifier( s.SUBSTR ); - if ( (vals != null) && (vals.length > 0) ) { - printString( " substring=" + vals[0] ); - } - printString( " <dsml:name>" + s.getName() + "</dsml:name>" ); - printString( " <dsml:description>" + s.getDescription() + - "</dsml:description>" ); - printString( " <dsml:syntax>" + s.getSyntaxString() + - "</dsml:syntax>" ); - printString( " </dsml:attribute-type>" ); - } - } - - - /** - * Print an attribute of an entry - * - * @param attr the attribute to format to the output stream - */ - protected void printAttribute( LDAPAttribute attr ) { - String attrName = attr.getName(); - - // Object classes are treated differently in DSML. Also, they - // are always String-valued - if ( attrName.equalsIgnoreCase( "objectclass" ) ) { - Enumeration enumVals = attr.getStringValues(); - if ( enumVals != null ) { - printString( " <dsml:objectclass>" ); - while ( enumVals.hasMoreElements() ) { - String s = (String)enumVals.nextElement(); - printString( " <dsml:oc-value>" + s + - "</dsml:oc-value>" ); - } - printString( " </dsml:objectclass>" ); - } - return; - } - - printString( " <dsml:attr name=\"" + attrName + "\">" ); - - /* Loop on values for this attribute */ - Enumeration enumVals = attr.getByteValues(); - - if ( enumVals != null ) { - while ( enumVals.hasMoreElements() ) { - byte[] b = (byte[])enumVals.nextElement(); - String s; - if ( LDIF.isPrintable(b) ) { - try { - s = new String( b, "UTF8" ); - } catch ( UnsupportedEncodingException e ) { - s = ""; - } - printEscapedValue( " <dsml:value>", s, - "</dsml:value>" ); - } else { - s = getPrintableValue( b ); - if ( s.length() > 0 ) { - printString( " " + - "<dsml:value encoding=\"base64\">" ); - printString( " " + s ); - printString( " </dsml:value>" ); - } - } - } - } - printString( " </dsml:attr>" ); - } - - /** - * Print prologue to entry - * - * @param dn the DN of the entry - */ - protected void printEntryStart( String dn ) { - -/* - if ( dn == null ) { - dn = ""; - } else { - byte[] b = null; - try { - b = dn.getBytes( "UTF8" ); - } catch ( UnsupportedEncodingException ex ) { - } - - if ( !LDIF.isPrintable(b) ) { - dn = getPrintableValue( b ); - printString( " <dsml:entry dn=\"" + dn + "\" encoding=\"base64\">" ); - return; - } - - } - printString( " <dsml:entry dn=\"" + dn + "\">" ); -*/ - - - if ( dn == null ) { - dn = ""; - } - m_pw.print( " <dsml:entry dn=\"" ); - printEscapedAttribute( dn ); - m_pw.println( "\">" ); - } - - /** - * Print epilogue to entry - * - * @param dn the DN of the entry - */ - protected void printEntryEnd( String dn ) { - printString( " </dsml:entry>" ); - } - - /** - * Print the element start, the value with escaping of special - * characters, and the element end - * - * @param prolog element start - * @param value value to be escaped - * @param epilog element end - */ - protected void printEscapedValue( String prolog, String value, - String epilog ) { - m_pw.print( prolog ); - int l = value.length(); - char[] text = new char[l]; - value.getChars( 0, l, text, 0 ); - for ( int i = 0; i < l; i++ ) { - char c = text[i]; - switch (c) { - case '<' : - m_pw.print( "<" ); - break; - case '&' : - m_pw.print( "&" ); - break; - default : - m_pw.print( c ); - } - } - // m_pw.print( epilog); - // m_pw.print( '\n' ); - m_pw.println( epilog ); - } - - /** - * Print the element attribute escaping of special - * characters - * - * @param attribute Attribute value to be escaped - */ - protected void printEscapedAttribute( String attribute ) { - - int l = attribute.length(); - char[] text = new char[l]; - attribute.getChars( 0, l, text, 0 ); - for ( int i = 0; i < l; i++ ) { - char c = text[i]; - switch (c) { - case '<' : - m_pw.print( "<" ); - break; - case '>': - m_pw.print( ">" ); - break; - case '&' : - m_pw.print( "&" ); - break; - case '"': - m_pw.print( """ ); - break; - case '\'': - m_pw.print( "'" ); - break; - default : - m_pw.print( c ); - } - } - } - - protected void printString( String value ) { - // m_pw.print( value ); - // m_pw.print( '\n' ); - m_pw.println( value ); - } -} diff --git a/ldap/admin/src/java/com/netscape/xmltools/GetOpt.java b/ldap/admin/src/java/com/netscape/xmltools/GetOpt.java deleted file mode 100644 index aa52cc6f..00000000 --- a/ldap/admin/src/java/com/netscape/xmltools/GetOpt.java +++ /dev/null @@ -1,254 +0,0 @@ -/** BEGIN COPYRIGHT BLOCK - * 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; version 2 of the License. - * - * 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. - * - * In addition, as a special exception, Red Hat, Inc. gives You the additional - * right to link the code of this Program with code not covered under the GNU - * General Public License ("Non-GPL Code") and to distribute linked combinations - * including the two, subject to the limitations in this paragraph. Non-GPL Code - * permitted under this exception must only link to the code of this Program - * through those well defined interfaces identified in the file named EXCEPTION - * found in the source code files (the "Approved Interfaces"). The files of - * Non-GPL Code may instantiate templates or use macros or inline functions from - * the Approved Interfaces without causing the resulting work to be covered by - * the GNU General Public License. Only Red Hat, Inc. may make changes or - * additions to the list of Approved Interfaces. You must obey the GNU General - * Public License in all respects for all of the Program code and other code used - * in conjunction with the Program except the Non-GPL Code covered by this - * exception. If you modify this file, you may extend this exception to your - * version of the file, but you are not obligated to do so. If you do not wish to - * provide this exception without modification, you must delete this exception - * statement from your version and license this file solely under the GPL without - * exception. - * - * - * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. - * All rights reserved. - * END COPYRIGHT BLOCK **/ -package com.netscape.xmltools; -import java.util.*; - -/** - * This class is similar to the <CODE>getopt()</CODE> function in - * UNIX System V. You can use this class to parse command-line - * arguments. - * <P> - * - * When you create an object of this class, you specify a string - * containing the command-line options that you want to check for. - * The string should contain the letters of these options. If an - * option requires an argument (for example, "-h <hostname>"), - * you should add a colon after the letter in this string. - * <P> - * - * For example, in the following string, the <CODE>-h</CODE>, - * <CODE>-p</CODE>, <CODE>-D,</CODE>, and <CODE>-w</CODE> options - * all require arguments. The <CODE>-H</CODE> option does not - * require any arguments. - * <PRE> - * "h:p:D:w:H" - * </PRE> - * - * You can use the <CODE>hasOption</CODE> method to determine if - * an option has been specified and the <CODE>getOptionParam</CODE> - * method to get the argument specified after a particular option. - * <P> - * - * If an option not specified in the string is passed in as an - * argument, the <CODE>GetOpt</CODE> object prints out an error - * message. Note that the object does not throw an exception or - * exit the application if an invalid option is specified. - * <P> - * - * Note that you are still responsible for verifying that any - * required arguments have been specified. - * <P> - * - * The following example parses the command-line arguments for - * the hostname, port number, DN, and password to use when - * connecting and authenticating to an LDAP server. - * <PRE> - * import netscape.ldap.*; - * import netscape.ldap.controls.*; - * import netscape.ldap.util.*; - * import java.util.*; - * - * public class SearchDirectory { - * - * public static void main( String[] args ) - * { - * - * String usage = "Usage: java SearchDirectory -h <host> -p <port> " - * + "[-D <bind dn>] [-w <password>]" - * - * int portnumber = LDAPv2.DEFAULT_PORT; - * - * // Check for these options. -H means to print out a usage message. - * GetOpt options = new GetOpt( "h:p:D:w:H", args ); - * - * // Get the arguments specified for each option. - * String hostname = options.getOptionParam( 'h' ); - * String port = options.getOptionParam( 'p' ); - * String bindDN = options.getOptionParam( 'D' ); - * String bindPW = options.getOptionParam( 'w' ); - * - * // Check to see if the hostname (which is mandatory) - * // is not specified or if the user simply wants to - * // see the usage message (-H). - * if ( hostname == null || options.hasOption( 'H' ) ) { - * System.out.println( usage ); - * System.exit( 1 ); - * } - * - * // If a port number was specified, convert the port value - * // to an integer. - * if ( port != null ) { - * try { - * portnumber = java.lang.Integer.parseInt( port ); - * } catch ( java.lang.Exception e ) { - * System.out.println( "Invalid port number: " + port ); - * System.out.println( usage ); - * System.exit( 1 ); - * } - * } - * - * // Create a new connection. - * LDAPConnection ld = new LDAPConnection(); - * - * try { - * // Connect and authenticate to server. - * ld.connect( 3, hostname, portnumber, bindDN, bindPW ); - * ... - * } catch ( LDAPException e ) { - * System.out.println( "Error: " + e.toString() ); - * } - * ... - * } - * } - * </PRE> - * - * @version 1.0 - */ -public class GetOpt implements java.io.Serializable { - /** - * Internal variables - */ - private int m_pos; - private String optarg; - private String m_control; - private Vector m_option; - private Vector m_ParameterList; - private Hashtable m_optionHashTable; - private Hashtable m_optionParamHashTable; - static final long serialVersionUID = -2570196909939660248L; - - /** - * Constructs a <CODE>GetOpt</CODE> object. - * @param strControl a string specifying the letters of - * all available options. If an option requires an argument - * (for example, "-h <hostname>"), use a colon after the - * letter for that option (for example, "h:p:D:w:H"). - * @param args an array of strings representing the list - * of arguments to parse (for example, the - * array passed into Main). - */ - public GetOpt(String strControl, String args[]) { - m_option = new Vector(); - m_control = strControl; - m_optionHashTable = new Hashtable(); - m_optionParamHashTable = new Hashtable(); - m_ParameterList = new Vector(); - - for (int i=0;i<args.length ;i++ ) { - String sOpt = args[i]; - if (sOpt.length()>0) { - if (sOpt.charAt(0)=='-') { - if (sOpt.length()>1) { - int nIndex = m_control.indexOf(sOpt.charAt(1)); - if (nIndex == (-1)) { - System.err.println("Invalid usage. No option -" + - sOpt.charAt(1)); - } else { - char cOpt[]= new char[1]; - cOpt[0]= sOpt.charAt(1); - String sName = new String(cOpt); - m_optionHashTable.put(sName,"1"); - if ((m_control != null) && (m_control.length() > (nIndex+1))) { - if (m_control.charAt(nIndex+1)==':') { - i++; - if (i < args.length) - m_optionParamHashTable.put(sName,args[i]); - else - System.err.println("Missing argument for option "+ - sOpt); - } - } - } - } else { - System.err.println("Invalid usage."); - } - } else { - // probably parameters - m_ParameterList.addElement(args[i]); - } - } - } - } - - /** - * Determines if an option was specified. For example, - * <CODE>hasOption( 'H' )</CODE> checks if the -H option - * was specified. - * <P> - * - * @param c letter of the option to check - * @return <code>true</code> if the option was specified. - */ - public boolean hasOption(char c) { - boolean fReturn = false; - char cOption[]=new char[1]; - cOption[0]=c; - String s = new String(cOption); - if (m_optionHashTable.get(s)=="1") { - fReturn = true; - } - return(fReturn); - } - - /** - * Gets the argument specified with an option. - * For example, <CODE>getOptionParameter( 'h' )</CODE> - * gets the value of the argument specified with - * the -h option (such as "localhost" in "-h localhost"). - * <P> - * - * @param c the letter of the option to check - * @return the argument specified for this option. - */ - public String getOptionParam(char c) { - char cOption[] = new char[1]; - cOption[0]=c; - String s = new String(cOption); - String sReturn=(String)m_optionParamHashTable.get(s); - return(sReturn); - } - - /** - * Gets a list of any additional parameters specified - * (not including the arguments for any options). - * @return a list of the additional parameters. - */ - public Vector getParameters() { - return(m_ParameterList); - } -} diff --git a/ldap/admin/src/java/com/netscape/xmltools/LDIF2DSML.java b/ldap/admin/src/java/com/netscape/xmltools/LDIF2DSML.java deleted file mode 100644 index 9db6a058..00000000 --- a/ldap/admin/src/java/com/netscape/xmltools/LDIF2DSML.java +++ /dev/null @@ -1,246 +0,0 @@ -/** BEGIN COPYRIGHT BLOCK - * 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; version 2 of the License. - * - * 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. - * - * In addition, as a special exception, Red Hat, Inc. gives You the additional - * right to link the code of this Program with code not covered under the GNU - * General Public License ("Non-GPL Code") and to distribute linked combinations - * including the two, subject to the limitations in this paragraph. Non-GPL Code - * permitted under this exception must only link to the code of this Program - * through those well defined interfaces identified in the file named EXCEPTION - * found in the source code files (the "Approved Interfaces"). The files of - * Non-GPL Code may instantiate templates or use macros or inline functions from - * the Approved Interfaces without causing the resulting work to be covered by - * the GNU General Public License. Only Red Hat, Inc. may make changes or - * additions to the list of Approved Interfaces. You must obey the GNU General - * Public License in all respects for all of the Program code and other code used - * in conjunction with the Program except the Non-GPL Code covered by this - * exception. If you modify this file, you may extend this exception to your - * version of the file, but you are not obligated to do so. If you do not wish to - * provide this exception without modification, you must delete this exception - * statement from your version and license this file solely under the GPL without - * exception. - * - * - * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. - * All rights reserved. - * END COPYRIGHT BLOCK **/ - -package com.netscape.xmltools; - -import java.io.*; -import java.util.*; -import netscape.ldap.util.GetOpt; -import netscape.ldap.util.*; -import netscape.ldap.*; - -/** - * Tool for converting LDIF document to DSML document - */ -public class LDIF2DSML { - - /** - * Default no argument constructor. - */ - public LDIF2DSML() { - } - - /** - * Converter taking a filename argument for the input LDIF file - * - * @param filename system-dependent file name for the input LDIF file - */ - public LDIF2DSML( String filename ) throws IOException { - - DataInputStream ds = null; - - if( filename == null || filename.length() == 0 ) { - ds = new DataInputStream( System.in ); - } - else { - ds = new DataInputStream( new FileInputStream( filename) ); - } - - // set up the ldif parser with the input stream - // - m_ldifReader = new LDIF( ds ); - } - - /** - * Converts an LDIF record to an LDAPEntry. Only convert if the content - * of the LDIF record is of the type LDIFContent.ATTRIBUTE_CONTENT. - * - * @param rec An LDIFRecord to be converted - * @returns The converted LDAPEntry. null is returned for any ldif record not - * being recognized with attribute content - */ - public LDAPEntry toLDAPEntry( LDIFRecord rec ) { - - String dn = rec.getDN(); - LDIFContent content = rec.getContent(); - - if (content.getType() == LDIFContent.ATTRIBUTE_CONTENT) { - LDIFAttributeContent entry = (LDIFAttributeContent)content; - /* LDAPAttribute attrs[] = entry.getAttributes(); - for( int i = 0; i < attrs.length; i++ ) { - System.err.println( attrs[i].toString() ); - }*/ - return new LDAPEntry( dn, new LDAPAttributeSet( entry.getAttributes()) ); - } - return null; - } - - /** - * Conversion from ldif to dsml document. - */ - public void convert() { - DSMLWriter writer = new DSMLWriter( m_pw ); - int recCount = 0; - int rejectCount = 0; - - try { - - m_pw.println( "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"); - m_pw.println( "<dsml:dsml xmlns:dsml=\"http://www.dsml.org/DSML\">"); - m_pw.println( " <dsml:directory-entries>" ); - - for( LDIFRecord rec = m_ldifReader.nextRecord(); - rec != null; rec = m_ldifReader.nextRecord(), recCount++ ) { - LDAPEntry entry = toLDAPEntry( rec ); - if (entry != null) { - writer.printEntry( entry ); - entry = null; - } - } - - m_pw.println( " </dsml:directory-entries>" ); - m_pw.println( "</dsml:dsml>" ); - - } catch (IOException e) { - e.printStackTrace(); - } finally { - m_pw.flush(); - m_pw.close(); - } - } - - /** - * Parse the command line parameters and setup the options parameters - */ - static private GetOpt parseParameters( String[] args ) { - - GetOpt options = new GetOpt("H?so:", args); - - if (options.hasOption('H') || options.hasOption('?')) { - usage(); - System.exit(0); - } - - if (options.hasOption('v')) { - m_verbose = true; - } - - if (options.hasOption('o')) { - m_outfile = options.getOptionParam('o'); - if (m_outfile == null) { - System.err.println( "Missing argument for output filename" ); - usage(); - System.exit(0); - } - - try { - /* - m_pw = null; - m_pw = new PrintWriter( new FileOutputStream(m_outfile), true ); - */ - - m_pw = null; - // always write DSML document out in UTF8 encoding - // - OutputStreamWriter os = new OutputStreamWriter( new FileOutputStream(m_outfile), "UTF8" ); - m_pw = new PrintWriter( os, true ); - } catch (IOException e) { - System.err.println( "Can't open " + m_outfile ); - System.err.println( e.toString() ); - System.exit(1); - } - } - - Vector extras = options.getParameters(); - if (extras.size() == 1 ) { - m_infile = new String( (String)extras.get(0) ); - } else { - if ( options.hasOption('s') ) { - // System.err.println( "Use standard input for input of ldif file" ); - m_infile = null; - } else { - usage(); - System.exit(0); - } - } - return options; - } - - /** - * Print out usage of the tool - */ - static private void usage() { - System.err.println("Usage: java [-classpath $CLASSPATH] LDIF2DSML infile.ldif [-s] [-o outfile.dsml]"); - System.err.println("options"); - System.err.println(" -s use standard input for input of ldif file" ); - System.err.println(" -o outfile filename for the output DSML file" ); - System.err.println(" -H -? for usage" ); - // System.err.println(" -v for verbose mode" ); - - } - - /** - * Main routine for the tool. - */ - static public void main(String[] args){ - - m_verify = Boolean.getBoolean("verify"); - - parseParameters( args); - - LDIF2DSML converter = null; - - try { - if (m_infile== null) { - converter = new LDIF2DSML( null ); - } - else { - converter = new LDIF2DSML( m_infile ); - } - } catch( IOException e ) { - System.err.println( "Error encountered in input" ); - System.err.println( e.toString() ); - System.exit( 1 ); - } - - if (m_verify) { - System.exit( 0 ); - } - - converter.convert(); - System.exit( 0 ); - - } - - static private PrintWriter m_pw = new PrintWriter(System.out, true); - static private boolean m_verbose = false; - static private String m_outfile = null; - static private String m_infile = null; - static private LDIF m_ldifReader = null; - static private boolean m_verify = false; -} diff --git a/ldap/admin/src/java/com/netscape/xmltools/Makefile b/ldap/admin/src/java/com/netscape/xmltools/Makefile deleted file mode 100644 index 94003092..00000000 --- a/ldap/admin/src/java/com/netscape/xmltools/Makefile +++ /dev/null @@ -1,99 +0,0 @@ -# -# BEGIN COPYRIGHT BLOCK -# 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; version 2 of the License. -# -# 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. -# -# In addition, as a special exception, Red Hat, Inc. gives You the additional -# right to link the code of this Program with code not covered under the GNU -# General Public License ("Non-GPL Code") and to distribute linked combinations -# including the two, subject to the limitations in this paragraph. Non-GPL Code -# permitted under this exception must only link to the code of this Program -# through those well defined interfaces identified in the file named EXCEPTION -# found in the source code files (the "Approved Interfaces"). The files of -# Non-GPL Code may instantiate templates or use macros or inline functions from -# the Approved Interfaces without causing the resulting work to be covered by -# the GNU General Public License. Only Red Hat, Inc. may make changes or -# additions to the list of Approved Interfaces. You must obey the GNU General -# Public License in all respects for all of the Program code and other code used -# in conjunction with the Program except the Non-GPL Code covered by this -# exception. If you modify this file, you may extend this exception to your -# version of the file, but you are not obligated to do so. If you do not wish to -# provide this exception without modification, you must delete this exception -# statement from your version and license this file solely under the GPL without -# exception. -# -# -# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. -# Copyright (C) 2005 Red Hat, Inc. -# All rights reserved. -# END COPYRIGHT BLOCK -# -# Name: -# Platform: gmake -# -------------------------------------------------------------------------- -override BUILD_MODULE=HTTP_ADMIN - -NOSTDCLEAN=true -NO_BUILD_NUM=true -COMPONENT_DEPS=true - -BUILD_ROOT=../../../../../../.. - -include $(BUILD_ROOT)/nsconfig.mk -include $(BUILD_ROOT)/ldap/javarules.mk -CLASS_DIR=$(JAVA_DEST_DIR)/xmltools -PACKAGE_DIR=$(ABS_ROOT_PARENT)/dist/$(BUILD_DEBUG) -_PACKAGE_DIR=$(NSCP_DIST)/$(BUILD_DEBUG) -DEST_DIR=$(CLASS_DIR)/com/netscape/xmltools -JARS_DIR=lib -TOOLS_JARS=$(JARS_DIR)/crimson.jar$(PATH_SEP)$(JARS_DIR)/ldapjdk.jar -TOOLS_JAR_FILE=xmltools.jar -# -# programs list -# -source = \ - $(DEST_DIR)/DSML2LDIF.class \ - $(DEST_DIR)/LDIF2DSML.class \ - $(DEST_DIR)/DSMLReader.class \ - $(DEST_DIR)/DSMLWriter.class \ - $(DEST_DIR)/GetOpt.class \ - $(DEST_DIR)/DSMLSAXBuilder.class \ - $(DEST_DIR)/DSMLSAXHandler.class - - -package: all $(_PACKAGE_DIR) -# when zip finds nothing to do, it exits with code 12 which is not an error -# so we turn that 12 into a 0 which means success so make will continue - cd $(CLASS_DIR); zip -r -u $(PACKAGE_DIR)/$(TOOLS_JAR_FILE) com || if [ $$? -eq 12 ]; then exit 0 ; else exit $$? ; fi - -all: $(DEST_DIR) $(CRIMSONJAR_DEP) $(LDAPJDK_DEP) $(source) - -clean: - rm -f $(DEST_DIR)/*.class; rm -f $(PACKAGE_DIR)/$(TOOLS_JAR_FILE) - -fresh: $(clean) $(all) - - -jdoc: ./doc - $(JAVADOC) -classpath "$(CLASSPATH)$(PATH_SEP)$(CLASS_DIR)$(PATH_SEP)$(CRIMSONJAR_FILE)" -d ./doc com.netscape.xmltools - -jdoc.clean : - rm -rf ./doc - -$(_PACKAGE_DIR): - mkdir -p $(_PACKAGE_DIR) - -$(DEST_DIR)/%.class : %.java - $(JAVAC) -deprecation -classpath "$(CLASSPATH)$(PATH_SEP)$(CLASS_DIR)$(PATH_SEP)$(CRIMSONJAR_FILE)" -d $(CLASS_DIR) $< - -$(DEST_DIR) ./doc: - mkdir -p $@ diff --git a/ldap/admin/src/java/install b/ldap/admin/src/java/install deleted file mode 100755 index c1ac5faf..00000000 --- a/ldap/admin/src/java/install +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -# -# BEGIN COPYRIGHT BLOCK -# 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; version 2 of the License. -# -# 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. -# -# In addition, as a special exception, Red Hat, Inc. gives You the additional -# right to link the code of this Program with code not covered under the GNU -# General Public License ("Non-GPL Code") and to distribute linked combinations -# including the two, subject to the limitations in this paragraph. Non-GPL Code -# permitted under this exception must only link to the code of this Program -# through those well defined interfaces identified in the file named EXCEPTION -# found in the source code files (the "Approved Interfaces"). The files of -# Non-GPL Code may instantiate templates or use macros or inline functions from -# the Approved Interfaces without causing the resulting work to be covered by -# the GNU General Public License. Only Red Hat, Inc. may make changes or -# additions to the list of Approved Interfaces. You must obey the GNU General -# Public License in all respects for all of the Program code and other code used -# in conjunction with the Program except the Non-GPL Code covered by this -# exception. If you modify this file, you may extend this exception to your -# version of the file, but you are not obligated to do so. If you do not wish to -# provide this exception without modification, you must delete this exception -# statement from your version and license this file solely under the GPL without -# exception. -# -# -# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. -# Copyright (C) 2005 Red Hat, Inc. -# All rights reserved. -# END COPYRIGHT BLOCK -# -if [ $# -lt 1 ] -then - echo >&2 "Usage: $0 targetDirectory" - exit 2 -fi -mkdir -p $1 -mkdir -p $1/jars -cp -p `dirname $0`/mcc $1 -cp -p -r `dirname $0`/jars/* $1/jars diff --git a/ldap/admin/src/java/mcc b/ldap/admin/src/java/mcc deleted file mode 100755 index 61b4ab3b..00000000 --- a/ldap/admin/src/java/mcc +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/sh -# -# BEGIN COPYRIGHT BLOCK -# 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; version 2 of the License. -# -# 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. -# -# In addition, as a special exception, Red Hat, Inc. gives You the additional -# right to link the code of this Program with code not covered under the GNU -# General Public License ("Non-GPL Code") and to distribute linked combinations -# including the two, subject to the limitations in this paragraph. Non-GPL Code -# permitted under this exception must only link to the code of this Program -# through those well defined interfaces identified in the file named EXCEPTION -# found in the source code files (the "Approved Interfaces"). The files of -# Non-GPL Code may instantiate templates or use macros or inline functions from -# the Approved Interfaces without causing the resulting work to be covered by -# the GNU General Public License. Only Red Hat, Inc. may make changes or -# additions to the list of Approved Interfaces. You must obey the GNU General -# Public License in all respects for all of the Program code and other code used -# in conjunction with the Program except the Non-GPL Code covered by this -# exception. If you modify this file, you may extend this exception to your -# version of the file, but you are not obligated to do so. If you do not wish to -# provide this exception without modification, you must delete this exception -# statement from your version and license this file solely under the GPL without -# exception. -# -# -# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. -# Copyright (C) 2005 Red Hat, Inc. -# All rights reserved. -# END COPYRIGHT BLOCK -# -if [ $# -lt 2 ] -then - echo >&2 "Usage: $0 host port [[user] [password]" - exit 2 -fi -MCC_HOST=$1 -MCC_PORT=$2 -# Has to be in the jars subdirectory -JARDIR=./jars -# -DS=${JARDIR}/ds40.jar -ADMIN=${JARDIR}/admserv.jar -KINGPIN=${JARDIR}/kingpin.jar -SWING=${JARDIR}/swingall.jar -LF=${JARDIR}/nmclf.jar -LAYOUT=${JARDIR}/layout.jar -LDAP=${JARDIR}/ldapjdk.jar -BASE=o=netscaperoot -CLASSPATH=${DS}:${KINGPIN}:${ADMIN}:${SWING}:${LAYOUT}:${LF}:${LDAP};export CLASSPATH -cd `dirname $0` -if [ $# -gt 3 ] -then - java com.netscape.management.client.console.Console -d ${MCC_HOST} -p ${MCC_PORT} -u "$3" -w "$4" -b ${BASE} -elif [ $# -gt 2 ] -then - java com.netscape.management.client.console.Console -d ${MCC_HOST} -p ${MCC_PORT} -u "$3" -b ${BASE} -else - java com.netscape.management.client.console.Console -d ${MCC_HOST} -p ${MCC_PORT} -b ${BASE} -fi - diff --git a/ldap/admin/src/java/mcc.bat b/ldap/admin/src/java/mcc.bat deleted file mode 100644 index 66eeccb7..00000000 --- a/ldap/admin/src/java/mcc.bat +++ /dev/null @@ -1,77 +0,0 @@ -@rem // -@rem // BEGIN COPYRIGHT BLOCK -@rem // This Program is free software; you can redistribute it and/or modify it under -@rem // the terms of the GNU General Public License as published by the Free Software -@rem // Foundation; version 2 of the License. -@rem // -@rem // This Program is distributed in the hope that it will be useful, but WITHOUT -@rem // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -@rem // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -@rem // -@rem // You should have received a copy of the GNU General Public License along with -@rem // this Program; if not, write to the Free Software Foundation, Inc., 59 Temple -@rem // Place, Suite 330, Boston, MA 02111-1307 USA. -@rem // -@rem // In addition, as a special exception, Red Hat, Inc. gives You the additional -@rem // right to link the code of this Program with code not covered under the GNU -@rem // General Public License ("Non-GPL Code") and to distribute linked combinations -@rem // including the two, subject to the limitations in this paragraph. Non-GPL Code -@rem // permitted under this exception must only link to the code of this Program -@rem // through those well defined interfaces identified in the file named EXCEPTION -@rem // found in the source code files (the "Approved Interfaces"). The files of -@rem // Non-GPL Code may instantiate templates or use macros or inline functions from -@rem // the Approved Interfaces without causing the resulting work to be covered by -@rem // the GNU General Public License. Only Red Hat, Inc. may make changes or -@rem // additions to the list of Approved Interfaces. You must obey the GNU General -@rem // Public License in all respects for all of the Program code and other code used -@rem // in conjunction with the Program except the Non-GPL Code covered by this -@rem // exception. If you modify this file, you may extend this exception to your -@rem // version of the file, but you are not obligated to do so. If you do not wish to -@rem // provide this exception without modification, you must delete this exception -@rem // statement from your version and license this file solely under the GPL without -@rem // exception. -@rem // -@rem // -@rem // Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. -@rem // Copyright (C) 2005 Red Hat, Inc. -@rem // All rights reserved. -@rem // END COPYRIGHT BLOCK -@rem // -@echo off -setlocal -set MCC_HOST=%1 -set MCC_PORT=%2 -if "%MCC_HOST%x"=="x" goto usage -if "%MCC_PORT%x"=="x" goto usage -rem -set MCC_USER= -if %3x==x goto nouser -set MCC_USER=-u %3 -echo MCC_USER = %MCC_USER% -:nouser -set MCC_PASSWORD= -if %4x==x goto nopass -set MCC_PASSWORD=-w %4 -:nopass -rem -set JARDIR=./jars -set JDK=%JARDIR%/classes.zip -set DS=%JARDIR%/ds40.jar -set ADMIN=%JARDIR%/admserv.jar -set KINGPIN=%JARDIR%/kingpin.jar -set SWING=%JARDIR%/swingall.jar -set LF=%JARDIR%/nmclf.jar -set LAYOUT=%JARDIR%/layout.jar -set LDAP=%JARDIR%/ldapjdk.jar -set BASE=o=netscaperoot -set CLASSPATH=%DS%;%KINGPIN%;%ADMIN%;%SWING%;%LAYOUT%;%LF%;%LDAP% -rem echo java com.netscape.management.client.console.Console -d %MCC_HOST% -p %MCC_PORT% %MCC_USER% %MCC_PASSWORD% -b %BASE% -java com.netscape.management.client.console.Console -d %MCC_HOST% -p %MCC_PORT% %MCC_USER% %MCC_PASSWORD% -b %BASE% -goto end - -:usage -echo Usage: mcc HOST PORT [[user] [password]] - -:end -endlocal - diff --git a/ldap/libraries/libldif/Makefile b/ldap/libraries/libldif/Makefile deleted file mode 100644 index c48da914..00000000 --- a/ldap/libraries/libldif/Makefile +++ /dev/null @@ -1,80 +0,0 @@ -# -# BEGIN COPYRIGHT BLOCK -# 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; version 2 of the License. -# -# 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. -# -# In addition, as a special exception, Red Hat, Inc. gives You the additional -# right to link the code of this Program with code not covered under the GNU -# General Public License ("Non-GPL Code") and to distribute linked combinations -# including the two, subject to the limitations in this paragraph. Non-GPL Code -# permitted under this exception must only link to the code of this Program -# through those well defined interfaces identified in the file named EXCEPTION -# found in the source code files (the "Approved Interfaces"). The files of -# Non-GPL Code may instantiate templates or use macros or inline functions from -# the Approved Interfaces without causing the resulting work to be covered by -# the GNU General Public License. Only Red Hat, Inc. may make changes or -# additions to the list of Approved Interfaces. You must obey the GNU General -# Public License in all respects for all of the Program code and other code used -# in conjunction with the Program except the Non-GPL Code covered by this -# exception. If you modify this file, you may extend this exception to your -# version of the file, but you are not obligated to do so. If you do not wish to -# provide this exception without modification, you must delete this exception -# statement from your version and license this file solely under the GPL without -# exception. -# -# -# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. -# Copyright (C) 2005 Red Hat, Inc. -# All rights reserved. -# END COPYRIGHT BLOCK -# -# -# GNU Makefile for libldif -# - -LDAP_SRC = ../.. -BUILD_ROOT = ../../.. - -NOSTDCLEAN=true # don't let nsconfig.mk define target clean -NOSTDSTRIP=true # don't let nsconfig.mk define target strip - -OBJDEST = $(OBJDIR)/lib/libldif -LIBDIR = $(LDAP_LIBDIR) - -include $(BUILD_ROOT)/nsdefs.mk -include $(BUILD_ROOT)/nsconfig.mk -include $(LDAP_SRC)/nsldap.mk - -CFLAGS += $(SLCFLAGS) - -LIBLDIF_OBJS= line64.o fileurl.o - -OBJS = $(addprefix $(OBJDEST)/, $(LIBLDIF_OBJS)) - -LIBLDIF= $(addprefix $(LIBDIR)/, libldif.$(LIB_SUFFIX)) - -clientSDK: all - -all: $(OBJDEST) $(LIBDIR) $(OBJS) $(LIBLDIF) - -$(LIBLDIF): $(OBJS) - $(LINK_LIB) - -veryclean: clean - -clean: - $(RM) $(OBJS) - $(RM) $(LIBLDIF) - -$(OBJDEST): - $(MKDIR) $(OBJDEST) - diff --git a/ldap/libraries/libldif/fileurl.c b/ldap/libraries/libldif/fileurl.c deleted file mode 100644 index 751c0bf3..00000000 --- a/ldap/libraries/libldif/fileurl.c +++ /dev/null @@ -1,326 +0,0 @@ -/** BEGIN COPYRIGHT BLOCK - * 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; version 2 of the License. - * - * 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. - * - * In addition, as a special exception, Red Hat, Inc. gives You the additional - * right to link the code of this Program with code not covered under the GNU - * General Public License ("Non-GPL Code") and to distribute linked combinations - * including the two, subject to the limitations in this paragraph. Non-GPL Code - * permitted under this exception must only link to the code of this Program - * through those well defined interfaces identified in the file named EXCEPTION - * found in the source code files (the "Approved Interfaces"). The files of - * Non-GPL Code may instantiate templates or use macros or inline functions from - * the Approved Interfaces without causing the resulting work to be covered by - * the GNU General Public License. Only Red Hat, Inc. may make changes or - * additions to the list of Approved Interfaces. You must obey the GNU General - * Public License in all respects for all of the Program code and other code used - * in conjunction with the Program except the Non-GPL Code covered by this - * exception. If you modify this file, you may extend this exception to your - * version of the file, but you are not obligated to do so. If you do not wish to - * provide this exception without modification, you must delete this exception - * statement from your version and license this file solely under the GPL without - * exception. - * - * - * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. - * All rights reserved. - * END COPYRIGHT BLOCK **/ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -/* - * LDIF tools fileurl.c -- functions for handling file URLs. - * Used by ldif_parse_line. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> -#include "fileurl.h" -#include <ctype.h> /* for isalpha() */ - -static int str_starts_with( char *s, char *prefix ); -static void hex_unescape( char *s ); -static int unhex( char c ); -static void strcpy_escaped_and_convert( char *s1, char *s2 ); - -/* - * Convert a file URL to a local path. - * - * If successful, LDIF_FILEURL_SUCCESS is returned and *localpathp is - * set point to an allocated string. If not, an different LDIF_FILEURL_ - * error code is returned. - * - * See RFCs 1738 and 2396 for a specification for file URLs... but - * Netscape Navigator seems to be a bit more lenient in what it will - * accept, especially on Windows). - * - * This function parses file URLs of these three forms: - * - * file:///path - * file:/path - * file://localhost/path - * file://host/path (rejected with a ...NONLOCAL error) - * - * On Windows, we convert leading drive letters of the form C| to C: - * and if a drive letter is present we strip off the slash that precedes - * path. Otherwise, the leading slash is returned. - * - */ -int -ldif_fileurl2path( char *fileurl, char **localpathp ) -{ - char *path; - - /* - * Make sure this is a file name or URL we can handle. - */ - if ( *fileurl == '/' || - ( isalpha( fileurl[0] ) && ( fileurl[1] == '|' || fileurl[1] == ':' ) ) ) { - path = fileurl; - goto path_ready; - } else if ( !str_starts_with( fileurl, "file:" )) { - return( LDIF_FILEURL_NOTAFILEURL ); - } - - path = fileurl + 5; /* skip past "file:" scheme prefix */ - - if ( *path != '/' ) { - return( LDIF_FILEURL_MISSINGPATH ); - } - - ++path; /* skip past '/' at end of "file:/" */ - - if ( *path == '/' ) { - ++path; /* remainder is now host/path or /path */ - if ( *path != '/' ) { - /* - * Make sure it is for the local host. - */ - if ( str_starts_with( path, "localhost/" )) { - path += 9; - } else { - return( LDIF_FILEURL_NONLOCAL ); - } - } - } else { /* URL is of the form file:/path */ - --path; - } - - /* - * The remainder is now of the form /path. On Windows, skip past the - * leading slash if a drive letter is present. - */ -#ifdef _WIN32 - if ( isalpha( path[1] ) && ( path[2] == '|' || path[2] == ':' )) { - ++path; - } -#endif /* _WIN32 */ - - - path_ready: - /* - * Duplicate the path so we can safely alter it. - * Unescape any %HH sequences. - */ - if (( path = strdup( path )) == NULL ) { - return( LDIF_FILEURL_NOMEMORY ); - } - hex_unescape( path ); - -#ifdef _WIN32 - /* - * Convert forward slashes to backslashes for Windows. Also, - * if we see a drive letter / vertical bar combination (e.g., c|) - * at the beginning of the path, replace the '|' with a ':'. - */ - { - char *p; - - for ( p = path; *p != '\0'; ++p ) { - if ( *p == '/' ) { - *p = '\\'; - } - } - } - - if ( isalpha( path[0] ) && path[1] == '|' ) { - path[1] = ':'; - } -#endif /* _WIN32 */ - - *localpathp = path; - return( LDIF_FILEURL_SUCCESS ); -} - - -/* - * Convert a local path to a file URL. - * - * If successful, LDIF_FILEURL_SUCCESS is returned and *urlp is - * set point to an allocated string. If not, an different LDIF_FILEURL_ - * error code is returned. At present, the only possible error is - * LDIF_FILEURL_NOMEMORY. - * - * This function produces file URLs of the form file:path. - * - * On Windows, we convert leading drive letters to C|. - * - */ -int -ldif_path2fileurl( char *path, char **urlp ) -{ - char *p, *url, *prefix ="file:"; - - if ( NULL == path ) { - path = "/"; - } - - /* - * Allocate space for the URL, taking into account that path may - * expand during the hex escaping process. - */ - if (( url = malloc( strlen( prefix ) + 3 * strlen( path ) + 1 )) == NULL ) { - return( LDIF_FILEURL_NOMEMORY ); - } - - strcpy( url, prefix ); - p = url + strlen( prefix ); - -#ifdef _WIN32 - /* - * On Windows, convert leading drive letters (e.g., C:) to the correct URL - * syntax (e.g., C|). - */ - if ( isalpha( path[0] ) && path[1] == ':' ) { - *p++ = path[0]; - *p++ = '|'; - path += 2; - *p = '\0'; - } -#endif /* _WIN32 */ - - /* - * Append the path, encoding any URL-special characters using the %HH - * convention. - * On Windows, convert backwards slashes in the path to forward ones. - */ - strcpy_escaped_and_convert( p, path ); - - *urlp = url; - return( LDIF_FILEURL_SUCCESS ); -} - - -/* - * Return a non-zero value if the string s begins with prefix and zero if not. - */ -static int -str_starts_with( char *s, char *prefix ) -{ - size_t prefix_len; - - if ( s == NULL || prefix == NULL ) { - return( 0 ); - } - - prefix_len = strlen( prefix ); - if ( strlen( s ) < prefix_len ) { - return( 0 ); - } - - return( strncmp( s, prefix, prefix_len ) == 0 ); -} - - -/* - * Remove URL hex escapes from s... done in place. The basic concept for - * this routine is borrowed from the WWW library HTUnEscape() routine. - * - */ -static void -hex_unescape( char *s ) -{ - char *p; - - for ( p = s; *s != '\0'; ++s ) { - if ( *s == '%' ) { - if ( *++s != '\0' ) { - *p = unhex( *s ) << 4; - } - if ( *++s != '\0' ) { - *p++ += unhex( *s ); - } - } else { - *p++ = *s; - } - } - - *p = '\0'; -} - - -/* - * Return the integer equivalent of one hex digit (in c). - * - */ -static int -unhex( char c ) -{ - return( c >= '0' && c <= '9' ? c - '0' - : c >= 'A' && c <= 'F' ? c - 'A' + 10 - : c - 'a' + 10 ); -} - - -#define HREF_CHAR_ACCEPTABLE( c ) (( c >= '-' && c <= '9' ) || \ - ( c >= '@' && c <= 'Z' ) || \ - ( c == '_' ) || \ - ( c >= 'a' && c <= 'z' )) - -/* - * Like strcat(), except if any URL-special characters are found in s2 - * they are escaped using the %HH convention and backslash characters are - * converted to forward slashes on Windows. - * - * Maximum space needed in s1 is 3 * strlen( s2 ) + 1. - * - */ -static void -strcpy_escaped_and_convert( char *s1, char *s2 ) -{ - char *p, *q; - char *hexdig = "0123456789ABCDEF"; - - p = s1 + strlen( s1 ); - for ( q = s2; *q != '\0'; ++q ) { -#ifdef _WIN32 - if ( *q == '\\' ) { - *p++ = '/'; - } else -#endif /* _WIN32 */ - - if ( HREF_CHAR_ACCEPTABLE( *q )) { - *p++ = *q; - } else { - *p++ = '%'; - *p++ = hexdig[ 0x0F & ((*(unsigned char*)q) >> 4) ]; - *p++ = hexdig[ 0x0F & *q ]; - } - } - - *p = '\0'; -} diff --git a/ldap/libraries/libldif/fileurl.h b/ldap/libraries/libldif/fileurl.h deleted file mode 100644 index 79ce02ed..00000000 --- a/ldap/libraries/libldif/fileurl.h +++ /dev/null @@ -1,77 +0,0 @@ -/** BEGIN COPYRIGHT BLOCK - * 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; version 2 of the License. - * - * 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. - * - * In addition, as a special exception, Red Hat, Inc. gives You the additional - * right to link the code of this Program with code not covered under the GNU - * General Public License ("Non-GPL Code") and to distribute linked combinations - * including the two, subject to the limitations in this paragraph. Non-GPL Code - * permitted under this exception must only link to the code of this Program - * through those well defined interfaces identified in the file named EXCEPTION - * found in the source code files (the "Approved Interfaces"). The files of - * Non-GPL Code may instantiate templates or use macros or inline functions from - * the Approved Interfaces without causing the resulting work to be covered by - * the GNU General Public License. Only Red Hat, Inc. may make changes or - * additions to the list of Approved Interfaces. You must obey the GNU General - * Public License in all respects for all of the Program code and other code used - * in conjunction with the Program except the Non-GPL Code covered by this - * exception. If you modify this file, you may extend this exception to your - * version of the file, but you are not obligated to do so. If you do not wish to - * provide this exception without modification, you must delete this exception - * statement from your version and license this file solely under the GPL without - * exception. - * - * - * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. - * All rights reserved. - * END COPYRIGHT BLOCK **/ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -/* - * LDIF tools fileurl.h -- defines for file URL functions. - * Used by ldif_parse_line. - */ - -/* - * ldif_fileurl2path() convert a file URL to a local path. - * - * If successful, LDIF_FILEURL_SUCCESS is returned and *localpathp is - * set point to an allocated string. If not, an differnet LDIF_FILEURL_ - * error code is returned. - */ -int ldif_fileurl2path( char *fileurl, char **localpathp ); - - -/* - * Convert a local path to a file URL. - * - * If successful, LDIF_FILEURL_SUCCESS is returned and *urlp is - * set point to an allocated string. If not, an different LDIF_FILEURL_ - * error code is returned. At present, the only possible error is - * LDIF_FILEURL_NOMEMORY. - * - */ -int ldif_path2fileurl( char *path, char **urlp ); - - -/* - * Possible return codes for ldif_fileurl2path and ldif_path2fileurl. - */ -#define LDIF_FILEURL_SUCCESS 0 -#define LDIF_FILEURL_NOTAFILEURL 1 -#define LDIF_FILEURL_MISSINGPATH 2 -#define LDIF_FILEURL_NONLOCAL 3 -#define LDIF_FILEURL_NOMEMORY 4 diff --git a/ldap/libraries/libldif/line64.c b/ldap/libraries/libldif/line64.c deleted file mode 100644 index 9cdc4941..00000000 --- a/ldap/libraries/libldif/line64.c +++ /dev/null @@ -1,783 +0,0 @@ -/* --- BEGIN COPYRIGHT BLOCK --- - * 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; version 2 of the License. - * - * 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. - * - * In addition, as a special exception, Red Hat, Inc. gives You the additional - * right to link the code of this Program with code not covered under the GNU - * General Public License ("Non-GPL Code") and to distribute linked combinations - * including the two, subject to the limitations in this paragraph. Non-GPL Code - * permitted under this exception must only link to the code of this Program - * through those well defined interfaces identified in the file named EXCEPTION - * found in the source code files (the "Approved Interfaces"). The files of - * Non-GPL Code may instantiate templates or use macros or inline functions from - * the Approved Interfaces without causing the resulting work to be covered by - * the GNU General Public License. Only Red Hat, Inc. may make changes or - * additions to the list of Approved Interfaces. You must obey the GNU General - * Public License in all respects for all of the Program code and other code used - * in conjunction with the Program except the Non-GPL Code covered by this - * exception. If you modify this file, you may extend this exception to your - * version of the file, but you are not obligated to do so. If you do not wish to - * provide this exception without modification, you must delete this exception - * statement from your version and license this file solely under the GPL without - * exception. - * - * - * Copyright (C) 2005 Red Hat, Inc. - * All rights reserved. - * --- END COPYRIGHT BLOCK --- */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - - -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * - * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. - * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. - */ -/* line64.c - routines for dealing with the slapd line format */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <ctype.h> -#ifndef macintosh -#include <sys/types.h> -#endif -#ifdef _WIN32 -#include <windows.h> -#elif !defined( macintosh ) -#include <sys/socket.h> -#endif -#include "ldaplog.h" -#include "ldif.h" -#include <errno.h> -#include "lber.h" -#include <sys/stat.h> -#include "fileurl.h" - -#include "nspr.h" - -#ifndef isascii -#define isascii( c ) (!((c) & ~0177)) -#endif - -#define RIGHT2 0x03 -#define RIGHT4 0x0f -#define CONTINUED_LINE_MARKER '\001' - -#define ISBLANK(c) (c == ' ' || c == '\t' || c == '\n') /* not "\r\v\f" */ - -#define LDIF_OPT_ISSET( value, opt ) (((value) & (opt)) != 0 ) - -static char nib2b64[0x40] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -static unsigned char b642nib[0x80] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0x3e, 0xff, 0xff, 0xff, 0x3f, - 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, - 0x3c, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, - 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, - 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, - 0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, - 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, - 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, - 0x31, 0x32, 0x33, 0xff, 0xff, 0xff, 0xff, 0xff -}; - -static int ldif_base64_encode_internal( unsigned char *src, char *dst, int srclen, - int lenused, int wraplen ); - -static int ldif_fromfile( char *path, struct berval *bv ); - -extern int errno; -/* - * ldif_parse_line - takes a line of the form "type:[:] value" and splits it - * into components "type" and "value". if a double colon separates type from - * value, then value is encoded in base 64, and parse_line un-decodes it - * (in place) before returning. - * Success return might be 0 (value is returned in place) or 1 (value has - * been malloc'ed) - */ - -int -ldif_parse_line( - char *line, - char **type, - char **value, - int *vlen, - char **errmsg -) -{ - char *p, *s, *d; - int b64; - int url = 0; - int rc = 0; - - *errmsg = NULL; - - /* skip any leading space */ - while ( ISBLANK( *line ) ) { - line++; - } - *type = line; - - for ( s = line; *s && *s != ':'; s++ ) - ; /* NULL */ - if ( *s == '\0' ) { - - /* Comment-out while we address calling libldif from ns-back-ldbm - on NT. 1 of 3 */ -#if defined( _WIN32 ) - /* -#endif - LDAPDebug( LDAP_DEBUG_PARSE, "ldif_parse_line: missing ':' " - "on line \"%s\"\n", line, 0, 0 ); -#if defined( _WIN32 ) - */ -#endif - return( -1 ); - } - - /* trim any space between type and : */ - for ( p = s - 1; p > line && ISBLANK( *p ); p-- ) { - *p = '\0'; - } - *s++ = '\0'; - - /* check for double : - indicates base 64 encoded value */ - if ( *s == ':' ) { - s++; - b64 = 1; - - /* single : - normally encoded value */ - } else { - /* check for ":<" - indicates value is actually an url */ - if (*s == '<') { - s++; - url = 1; - } - b64 = 0; - } - - /* skip space between : and value */ - while ( ISBLANK( *s ) ) { - s++; - } - - /* - * If no value is present, return a zero-length string for - * *value, with *vlen set to zero. - */ - if ( *s == '\0' ) { - *value = s; - *vlen = 0; - return( 0 ); - } - - /* check for continued line markers that should be deleted */ - for ( p = s, d = s; *p; p++ ) { - if ( *p != CONTINUED_LINE_MARKER ) - *d++ = *p; - } - *d = '\0'; - - *value = s; - if ( b64 ) { - if (( *vlen = ldif_base64_decode( s, (unsigned char *)s )) - < 0 ) { - /* Comment-out while we address calling libldif from ns-back-ldbm - on NT. 3 of 3 */ -#if defined( _WIN32 ) - /* -#endif - LDAPDebug( LDAP_DEBUG_ANY, - "ldif_parse_line: invalid base 64 char on line \"%s\"\n", - line, 0, 0 ); -#if defined( _WIN32 ) - */ -#endif - return( -1 ); - } - s[ *vlen ] = '\0'; - - } else if (url) { - - char *path; - struct stat fstats; - struct berval bv; - - bv.bv_val = NULL; - - /* - * We only support file:// URLs for now. - */ - - switch( ldif_fileurl2path( s, &path )) { - case LDIF_FILEURL_NOTAFILEURL: - *errmsg = PR_smprintf( - "ldif_parse_line: unsupported URL \"%s\";" - " use a file:// URL instead.\n", s); - rc = -1; - break; - - case LDIF_FILEURL_MISSINGPATH: - *errmsg = PR_smprintf( - "ldif_parse_line: unable to process URL \"%s\" --" - " missing path..\n", s); - rc = -1; - break; - - case LDIF_FILEURL_NONLOCAL: - *errmsg = PR_smprintf( - "ldif_parse_line: unable to process URL \"%s\" --" - " only local file:// URLs are supported.\n", s); - rc = -1; - break; - - case LDIF_FILEURL_NOMEMORY: - perror( "ldif_fileurl2path" ); - rc = -1; - break; - - case LDIF_FILEURL_SUCCESS: - if ( stat( path, &fstats ) != 0 ) { - perror( path ); - rc = -1; - } else if ( fstats.st_mode & S_IFDIR ) { - *errmsg = PR_smprintf( - "ldif_parse_line: %s is a directory, not a file.\n", path); - rc = -1; - } else if ( ldif_fromfile( path, &bv ) < 0 ) { - *errmsg = PR_smprintf( - "ldif_parse_line: unable to retrieve information" - " from file %s.\n", path); - rc = -1; - } - free( path ); - break; - - default: - *errmsg = PR_smprintf( - "ldif_parse_line: unable to process URL \"%s\" --" - " unknown error.\n", s); - rc = -1; - } - - - if ( rc != 0 ) { - if (bv.bv_val) - free(bv.bv_val); - } else { - *value = bv.bv_val; - *vlen = bv.bv_len; - rc = 1; - } - } else { - *vlen = (int) (d - s); - } - - return( rc ); -} - - -/* - * ldif_base64_decode - take the BASE64-encoded characters in "src" - * (a zero-terminated string) and decode them into the the buffer "dst". - * "src" and "dst" can be the same if in-place decoding is desired. - * "dst" must be large enough to hold the decoded octets. No more than - * 3 * strlen( src ) / 4 bytes will be produced. - * "dst" may contain zero octets anywhere within it, but it is not - * zero-terminated by this function. - * - * The number of bytes copied to "dst" is returned if all goes well. - * -1 is returned if the BASE64 encoding in "src" is invalid. - */ - -int -ldif_base64_decode( char *src, unsigned char *dst ) -{ - char *p, *stop; - unsigned char nib, *byte; - int i, len; - - stop = strchr( src, '\0' ); - byte = dst; - for ( p = src, len = 0; p < stop; p += 4, len += 3 ) { - for ( i = 0; i < 4; i++ ) { - if ( p[i] != '=' && (p[i] & 0x80 || - b642nib[ p[i] & 0x7f ] > 0x3f) ) { - return( -1 ); - } - } - - /* first digit */ - nib = b642nib[ p[0] & 0x7f ]; - byte[0] = nib << 2; - - /* second digit */ - nib = b642nib[ p[1] & 0x7f ]; - byte[0] |= nib >> 4; - - /* third digit */ - if ( p[2] == '=' ) { - len += 1; - break; - } - byte[1] = (nib & RIGHT4) << 4; - nib = b642nib[ p[2] & 0x7f ]; - byte[1] |= nib >> 2; - - /* fourth digit */ - if ( p[3] == '=' ) { - len += 2; - break; - } - byte[2] = (nib & RIGHT2) << 6; - nib = b642nib[ p[3] & 0x7f ]; - byte[2] |= nib; - - byte += 3; - } - - return( len ); -} - -/* - * ldif_getline - return the next "line" (minus newline) of input from a - * string buffer of lines separated by newlines, terminated by \n\n - * or \0. this routine handles continued lines, bundling them into - * a single big line before returning. if a line begins with a white - * space character, it is a continuation of the previous line. the white - * space character (nb: only one char), and preceeding newline are changed - * into CONTINUED_LINE_MARKER chars, to be deleted later by the - * ldif_parse_line() routine above. - * - * it takes a pointer to a pointer to the buffer on the first call, - * which it updates and must be supplied on subsequent calls. - * - * XXX need to update this function to also support <CR><LF> as EOL. - * XXX supports <CR><LF> as of 07/29/1998 (richm) - */ - -char * -ldif_getline( char **next ) -{ - char *l; - char c; - char *p; - - if ( *next == NULL || **next == '\n' || **next == '\0' ) { - return( NULL ); - } - - while ( **next == '#' ) { /* skip comment lines */ - if (( *next = strchr( *next, '\n' )) == NULL ) { - return( NULL ); - } - (*next)++; - } - - l = *next; - while ( (*next = strchr( *next, '\n' )) != NULL ) { - p = *next - 1; /* pointer to character previous to the newline */ - c = *(*next + 1); /* character after the newline */ - if ( ISBLANK( c ) && c != '\n' ) { - /* DOS EOL is \r\n, so if the character before */ - /* the \n is \r, continue it too */ - if (*p == '\r') - *p = CONTINUED_LINE_MARKER; - **next = CONTINUED_LINE_MARKER; - *(*next+1) = CONTINUED_LINE_MARKER; - } else { - /* DOS EOL is \r\n, so if the character before */ - /* the \n is \r, null it too */ - if (*p == '\r') - *p = '\0'; - *(*next)++ = '\0'; - break; - } - (*next)++; - } - - return( l ); -} - - -#define LDIF_SAFE_CHAR( c ) ( (c) != '\r' && (c) != '\n' ) -#define LDIF_CONSERVATIVE_CHAR( c ) ( LDIF_SAFE_CHAR(c) && isascii((c)) \ - && ( isprint((c)) || (c) == '\t' )) -#define LDIF_SAFE_INITCHAR( c ) ( LDIF_SAFE_CHAR(c) && (c) != ':' \ - && (c) != ' ' && (c) != '<' ) -#define LDIF_CONSERVATIVE_INITCHAR( c ) ( LDIF_SAFE_INITCHAR( c ) && \ - ! ( isascii((c)) && isspace((c)))) -#define LDIF_CONSERVATIVE_FINALCHAR( c ) ( (c) != ' ' ) - - -void -ldif_put_type_and_value_with_options( char **out, char *t, char *val, - int vlen, unsigned long options ) -{ - unsigned char *p, *byte, *stop; - char *save; - int b64, len, savelen, wraplen; - len = 0; - - if ( LDIF_OPT_ISSET( options, LDIF_OPT_NOWRAP )) { - wraplen = -1; - } else { - wraplen = LDIF_MAX_LINE_WIDTH; - } - - /* put the type + ": " */ - for ( p = (unsigned char *) t; *p; p++, len++ ) { - *(*out)++ = *p; - } - *(*out)++ = ':'; - len++; - if ( LDIF_OPT_ISSET( options, LDIF_OPT_VALUE_IS_URL )) { - *(*out)++ = '<'; /* add '<' for URLs */ - len++; - } - save = *out; - savelen = len; - b64 = 0; - - stop = (unsigned char *)val; - if ( val && vlen > 0 ) { - *(*out)++ = ' '; - stop = (unsigned char *) (val + vlen); - if ( LDIF_OPT_ISSET( options, LDIF_OPT_MINIMAL_ENCODING )) { - if ( !LDIF_SAFE_INITCHAR( val[0] )) { - b64 = 1; - } - } else { - if ( !LDIF_CONSERVATIVE_INITCHAR( val[0] ) || - !LDIF_CONSERVATIVE_FINALCHAR( val[vlen-1] )) { - b64 = 1; - } - } - } - - if ( !b64 ) { - for ( byte = (unsigned char *) val; byte < stop; - byte++, len++ ) { - if ( LDIF_OPT_ISSET( options, - LDIF_OPT_MINIMAL_ENCODING )) { - if ( !LDIF_SAFE_CHAR( *byte )) { - b64 = 1; - break; - } - } else if ( !LDIF_CONSERVATIVE_CHAR( *byte )) { - b64 = 1; - break; - } - - if ( wraplen != -1 && len > wraplen ) { - *(*out)++ = '\n'; - *(*out)++ = ' '; - len = 1; - } - *(*out)++ = *byte; - } - } - - if ( b64 ) { - *out = save; - *(*out)++ = ':'; - *(*out)++ = ' '; - len = ldif_base64_encode_internal( (unsigned char *)val, *out, vlen, - savelen + 2, wraplen ); - *out += len; - } - - *(*out)++ = '\n'; -} - -void -ldif_put_type_and_value( char **out, char *t, char *val, int vlen ) -{ - ldif_put_type_and_value_with_options( out, t, val, vlen, 0 ); -} - -void -ldif_put_type_and_value_nowrap( char **out, char *t, char *val, int vlen ) -{ - ldif_put_type_and_value_with_options( out, t, val, vlen, LDIF_OPT_NOWRAP ); -} - -/* - * ldif_base64_encode_internal - encode "srclen" bytes in "src", place BASE64 - * encoded bytes in "dst" and return the length of the BASE64 - * encoded string. "dst" is also zero-terminated by this function. - * - * If "lenused" >= 0, newlines will be included in "dst" and "lenused" if - * appropriate. "lenused" should be a count of characters already used - * on the current line. The LDIF lines we create will contain at most - * "wraplen" characters on each line, unless "wraplen" is -1, in which - * case output line length is unlimited. - * - * If "lenused" < 0, no newlines will be included, and the LDIF_BASE64_LEN() - * macro can be used to determine how many bytes will be placed in "dst." - */ - -static int -ldif_base64_encode_internal( unsigned char *src, char *dst, int srclen, int lenused, int wraplen ) -{ - unsigned char *byte, *stop; - unsigned char buf[3]; - char *out; - unsigned long bits; - int i, pad, len; - - len = 0; - out = dst; - stop = src + srclen; - - /* convert to base 64 (3 bytes => 4 base 64 digits) */ - for ( byte = src; byte < stop - 2; byte += 3 ) { - bits = (byte[0] & 0xff) << 16; - bits |= (byte[1] & 0xff) << 8; - bits |= (byte[2] & 0xff); - - for ( i = 0; i < 4; i++, bits <<= 6 ) { - if ( wraplen != -1 && lenused >= 0 && lenused++ > wraplen ) { - *out++ = '\n'; - *out++ = ' '; - lenused = 2; - } - - /* get b64 digit from high order 6 bits */ - *out++ = nib2b64[ (bits & 0xfc0000L) >> 18 ]; - } - } - - /* add padding if necessary */ - if ( byte < stop ) { - for ( i = 0; byte + i < stop; i++ ) { - buf[i] = byte[i]; - } - for ( pad = 0; i < 3; i++, pad++ ) { - buf[i] = '\0'; - } - byte = buf; - bits = (byte[0] & 0xff) << 16; - bits |= (byte[1] & 0xff) << 8; - bits |= (byte[2] & 0xff); - - for ( i = 0; i < 4; i++, bits <<= 6 ) { - if ( wraplen != -1 && lenused >= 0 && lenused++ > wraplen ) { - *out++ = '\n'; - *out++ = ' '; - lenused = 2; - } - - if (( i == 3 && pad > 0 ) || ( i == 2 && pad == 2 )) { - /* Pad as appropriate */ - *out++ = '='; - } else { - /* get b64 digit from low order 6 bits */ - *out++ = nib2b64[ (bits & 0xfc0000L) >> 18 ]; - } - } - } - - *out = '\0'; - - return( out - dst ); -} - -int -ldif_base64_encode( unsigned char *src, char *dst, int srclen, int lenused ) -{ - return ldif_base64_encode_internal( src, dst, srclen, lenused, LDIF_MAX_LINE_WIDTH ); -} - -int -ldif_base64_encode_nowrap( unsigned char *src, char *dst, int srclen, int lenused ) -{ - return ldif_base64_encode_internal( src, dst, srclen, lenused, -1 ); -} - - -/* - * return malloc'd, zero-terminated LDIF line - */ -char * -ldif_type_and_value_with_options( char *type, char *val, int vlen, - unsigned long options ) -{ - char *buf, *p; - int tlen; - - tlen = strlen( type ); - if (( buf = (char *)malloc( LDIF_SIZE_NEEDED( tlen, vlen ) + 1 )) != - NULL ) { - p = buf; - ldif_put_type_and_value_with_options( &p, type, val, vlen, options ); - *p = '\0'; - } - - return( buf ); -} - -char * -ldif_type_and_value( char *type, char *val, int vlen ) -{ - return ldif_type_and_value_with_options( type, val, vlen, 0 ); -} - -char * -ldif_type_and_value_nowrap( char *type, char *val, int vlen ) -{ - return ldif_type_and_value_with_options( type, val, vlen, LDIF_OPT_NOWRAP ); -} - -/* - * ldif_get_entry - read the next ldif entry from the FILE referenced - * by fp. return a pointer to a malloc'd, null-terminated buffer. also - * returned is the last line number read, in *lineno. - */ -char * -ldif_get_entry( FILE *fp, int *lineno ) -{ - char line[BUFSIZ]; - char *buf; - int max, cur, len, gotsome; - - buf = NULL; - max = cur = gotsome = 0; - while ( fgets( line, sizeof(line), fp ) != NULL ) { - if ( lineno != NULL ) { - (*lineno)++; - } - /* ldif entries are terminated by a \n on a line by itself */ - if ( line[0] == '\0' || line[0] == '\n' -#if !defined( XP_WIN32 ) - || ( line[0] == '\r' && line[1] == '\n' ) /* DOS format */ -#endif - ) { - if ( gotsome ) { - break; - } else { - continue; - } - } else if ( line[0] == '#' ) { - continue; - } - gotsome = 1; - len = strlen( line ); -#if !defined( XP_WIN32 ) - /* DOS format */ - if ( len > 0 && line[len-1] == '\r' ) { - --len; - line[len] = '\0'; - } else if ( len > 1 && line[len-2] == '\r' && line[len-1] == '\n' ) { - --len; - line[len-1] = line[len]; - line[len] = '\0'; - } -#endif - while ( cur + (len + 1) > max ) { - if ( buf == NULL ) { - max += BUFSIZ; - buf = (char *) malloc( max ); - } else { - max *= 2; - buf = (char *) realloc( buf, max ); - } - if ( buf == NULL ) { - return( NULL ); - } - } - - memcpy( buf + cur, line, len + 1 ); - cur += len; - } - - return( buf ); -} - - - -static int -ldif_fromfile( char *path, struct berval *bv ) -{ - FILE *fp; - long rlen; - int eof; -#if defined( XP_WIN32 ) - char mode[20] = "r+b"; -#else - char mode[20] = "r"; -#endif - - if (( fp = fopen( path, mode )) == NULL ) { - perror( path ); - return( -1 ); - } - - if ( fseek( fp, 0L, SEEK_END ) != 0 ) { - perror( path ); - fclose( fp ); - return( -1 ); - } - - bv->bv_len = ftell( fp ); - - if (( bv->bv_val = (char *)malloc( bv->bv_len + 1 )) == NULL ) { - perror( "malloc" ); - fclose( fp ); - return( -1 ); - } - - if ( fseek( fp, 0L, SEEK_SET ) != 0 ) { - perror( path ); - fclose( fp ); - return( -1 ); - } - - rlen = fread( bv->bv_val, 1, bv->bv_len, fp ); - eof = feof( fp ); - fclose( fp ); - - if ( rlen != (long)bv->bv_len ) { - perror( path ); - free( bv->bv_val ); - return( -1 ); - } - - bv->bv_val[ bv->bv_len ] = '\0'; - return( bv->bv_len ); -} - - diff --git a/ldap/libraries/liblitekey/Makefile b/ldap/libraries/liblitekey/Makefile deleted file mode 100644 index cf5d2996..00000000 --- a/ldap/libraries/liblitekey/Makefile +++ /dev/null @@ -1,78 +0,0 @@ -# -# BEGIN COPYRIGHT BLOCK -# 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; version 2 of the License. -# -# 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. -# -# In addition, as a special exception, Red Hat, Inc. gives You the additional -# right to link the code of this Program with code not covered under the GNU -# General Public License ("Non-GPL Code") and to distribute linked combinations -# including the two, subject to the limitations in this paragraph. Non-GPL Code -# permitted under this exception must only link to the code of this Program -# through those well defined interfaces identified in the file named EXCEPTION -# found in the source code files (the "Approved Interfaces"). The files of -# Non-GPL Code may instantiate templates or use macros or inline functions from -# the Approved Interfaces without causing the resulting work to be covered by -# the GNU General Public License. Only Red Hat, Inc. may make changes or -# additions to the list of Approved Interfaces. You must obey the GNU General -# Public License in all respects for all of the Program code and other code used -# in conjunction with the Program except the Non-GPL Code covered by this -# exception. If you modify this file, you may extend this exception to your -# version of the file, but you are not obligated to do so. If you do not wish to -# provide this exception without modification, you must delete this exception -# statement from your version and license this file solely under the GPL without -# exception. -# -# -# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. -# Copyright (C) 2005 Red Hat, Inc. -# All rights reserved. -# END COPYRIGHT BLOCK -# -# -# GNU Makefile for liblitekey -# - -LDAP_SRC = ../.. -BUILD_ROOT = ../../.. - -NOSTDCLEAN=true # don't let nsconfig.mk define target clean -NOSTDSTRIP=true # don't let nsconfig.mk define target strip - -OBJDEST = $(OBJDIR)/lib/liblitekey -LIBDIR = $(LDAP_LIBDIR) - -include $(BUILD_ROOT)/nsdefs.mk -include $(BUILD_ROOT)/nsconfig.mk -include $(LDAP_SRC)/nsldap.mk - -CFLAGS += $(SLCFLAGS) - -LIBLITEKEY_OBJS= keycheck.o - -OBJS = $(addprefix $(OBJDEST)/, $(LIBLITEKEY_OBJS)) - -LIBLITEKEY = $(addprefix $(LIBDIR)/, liblitekey.$(LIB_SUFFIX)) - -all: $(OBJDEST) $(LIBDIR) $(OBJS) $(LIBLITEKEY) - -$(LIBLITEKEY): $(OBJS) - $(LINK_LIB) - -veryclean: clean - -clean: - $(RM) $(OBJS) - $(RM) $(LIBLITEKEY) - -$(OBJDEST): - $(MKDIR) $(OBJDEST) - diff --git a/ldap/libraries/liblitekey/keycheck.c b/ldap/libraries/liblitekey/keycheck.c deleted file mode 100644 index 6d9d41b8..00000000 --- a/ldap/libraries/liblitekey/keycheck.c +++ /dev/null @@ -1,108 +0,0 @@ -/** BEGIN COPYRIGHT BLOCK - * 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; version 2 of the License. - * - * 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. - * - * In addition, as a special exception, Red Hat, Inc. gives You the additional - * right to link the code of this Program with code not covered under the GNU - * General Public License ("Non-GPL Code") and to distribute linked combinations - * including the two, subject to the limitations in this paragraph. Non-GPL Code - * permitted under this exception must only link to the code of this Program - * through those well defined interfaces identified in the file named EXCEPTION - * found in the source code files (the "Approved Interfaces"). The files of - * Non-GPL Code may instantiate templates or use macros or inline functions from - * the Approved Interfaces without causing the resulting work to be covered by - * the GNU General Public License. Only Red Hat, Inc. may make changes or - * additions to the list of Approved Interfaces. You must obey the GNU General - * Public License in all respects for all of the Program code and other code used - * in conjunction with the Program except the Non-GPL Code covered by this - * exception. If you modify this file, you may extend this exception to your - * version of the file, but you are not obligated to do so. If you do not wish to - * provide this exception without modification, you must delete this exception - * statement from your version and license this file solely under the GPL without - * exception. - * - * - * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. - * All rights reserved. - * END COPYRIGHT BLOCK **/ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -/* - * keycheck.c - */ - - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <litekey.h> - -#define DS_NORMAL_MAGIC_KEY 119 -#define FILE_PATHSEP '/' -#define BUFSIZE 800 - -/* - * is_directory_lite - * - * Checks if the directory server installation is a normal or a - * lite. The decision is made based on the key in the key file. - * - * Input: - * char *root; Pathname to install root - * Returns: - * 1 - yes, it's LITE server - * 0 - No; it's fully paid (normal) server. - * - */ -int is_directory_lite( char *root) -{ - return DS_NORMAL_TYPE; /* richm: no more lite mode in DS 5.0 */ -} - -/* - * generate_lite_key - * Generate a key for the product that is being used. - * - * Input: - * type DS_NORMAL_TYPE - Normal - * DS_LITE_TYPE - Lite - * Returns: - * a int key. - * - */ -int generate_directory_key( int type) -{ - - int key = 0; - int val; - - val = rand(); - - key = val * DS_NORMAL_MAGIC_KEY; - - return key; -} - -/* - * is_key_validNormalKey - * - * Check if the key ia a valid normal key or not. - */ -int -is_key_validNormalKey ( int key ) -{ - return 1; -} |
