From 8f11966bff2faa0821b8c735e59ee77af73bf124 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Thu, 12 Nov 1998 23:19:16 +0000 Subject: [PATCH] Modified UD as necessary to compile and link under NT. --- clients/ud/auth.c | 35 ++++++++++-- clients/ud/edit.c | 14 +++++ clients/ud/main.c | 5 ++ clients/ud/ud.dsp | 137 ++++++++++++++++++++++++++++++++++++++++++++++ clients/ud/ud.dsw | 74 +++++++++++++++++++++++++ clients/ud/util.c | 2 +- 6 files changed, 260 insertions(+), 7 deletions(-) create mode 100644 clients/ud/ud.dsp create mode 100644 clients/ud/ud.dsw diff --git a/clients/ud/auth.c b/clients/ud/auth.c index 5440037e9d..193829e56a 100644 --- a/clients/ud/auth.c +++ b/clients/ud/auth.c @@ -13,13 +13,17 @@ #include "portable.h" #include -#include +#include #include #include #include #include +#ifdef HAVE_PWD_H +#include +#endif + #include #include #include @@ -51,7 +55,11 @@ int implicit; char **rdns; /* for fiddling with the DN */ int authmethod; int name_provided; /* was a name passed in? */ +#ifdef HAVE_GETPWUID struct passwd *pw; /* for getting user id */ +#else + char *user; +#endif char uidname[20]; #ifdef HAVE_KERBEROS char **krbnames; /* for kerberos names */ @@ -81,11 +89,26 @@ int implicit; * The user needs to bind. If is not specified, we * assume that authenticating as user id is what user wants. */ - if (who == NULL && implicit && (pw = getpwuid((uid_t)geteuid())) - != (struct passwd *) NULL) { - sprintf(uidname, "uid=%s", pw->pw_name); - /* who = pw->pw_name; /* */ - who = uidname; + if (who == NULL && implicit) { + uidname[0] = '\0'; + +#ifdef HAVE_GETPWUID + if ((pw = getpwuid((uid_t)geteuid())) != (struct passwd *) NULL) { + sprintf(uidname, "uid=%s", pw->pw_name); + } +#else + user = getenv("USER"); + if(user == NULL) user = getenv("USERNAME"); + if(user == NULL) user = getenv("LOGNAME"); + + if(user != NULL) { + sprintf(uidname, "uid=%s", user); + } +#endif + + if(uidname[0] != '\0') { + who = uidname; + } } if ( who == NULL ) { diff --git a/clients/ud/edit.c b/clients/ud/edit.c index a7e1d92e72..d780c5ab9e 100644 --- a/clients/ud/edit.c +++ b/clients/ud/edit.c @@ -20,7 +20,12 @@ #include #include +#ifdef HAVE_SYS_RESOURCE_H #include +#endif +#ifdef HAVE_PROCESS_H +#include +#endif #include #include @@ -172,8 +177,16 @@ static load_editor() ++p; } printf(" Using %s as the editor...\n", p ); +#ifndef HAVE_SPAWNLP sleep(2); +#endif } +#ifdef HAVE_SPAWNLP + rc = _spawnlp( _P_WAIT, editor, editor, entry_temp_file, NULL ); + if(rc != 0) { + fatal("spawnlp"); + } +#else if ((pid = fork()) == 0) { /* child - edit the Directory entry */ (void) SIGNAL(SIGINT, SIG_IGN); @@ -191,6 +204,7 @@ static load_editor() fatal("fork"); /*NOTREACHED*/ } +#endif return(0); } diff --git a/clients/ud/main.c b/clients/ud/main.c index e700875670..22323537f7 100644 --- a/clients/ud/main.c +++ b/clients/ud/main.c @@ -21,7 +21,10 @@ #include #include #include + +#ifdef HAVE_PWD_H #include +#endif #include #include @@ -562,6 +565,7 @@ void initialize_client() * A per-user config file has precedence over any system-wide * config file, if one exists. */ +#ifdef HAVE_GETPWUID_H if ((pw = getpwuid((uid_t) geteuid())) == (struct passwd *) NULL) config = config_file; else { @@ -576,6 +580,7 @@ void initialize_client() config = config_file; } } +#endif /* getpwduid() */ #ifdef DEBUG if (debug & D_INITIALIZE) printf("Using config file %s\n", config); diff --git a/clients/ud/ud.dsp b/clients/ud/ud.dsp new file mode 100644 index 0000000000..2274449996 --- /dev/null +++ b/clients/ud/ud.dsp @@ -0,0 +1,137 @@ +# Microsoft Developer Studio Project File - Name="ud" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=ud - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "ud.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "ud.mak" CFG="ud - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "ud - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "ud - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "ud - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib hs_regex.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "ud - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib hs_regex.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug" + +!ENDIF + +# Begin Target + +# Name "ud - Win32 Release" +# Name "ud - Win32 Debug" +# Begin Source File + +SOURCE=.\auth.c +# End Source File +# Begin Source File + +SOURCE=.\edit.c +# End Source File +# Begin Source File + +SOURCE=.\find.c +# End Source File +# Begin Source File + +SOURCE=.\globals.c +# End Source File +# Begin Source File + +SOURCE=.\group.c +# End Source File +# Begin Source File + +SOURCE=.\help.c +# End Source File +# Begin Source File + +SOURCE=.\main.c +# End Source File +# Begin Source File + +SOURCE=.\mod.c +# End Source File +# Begin Source File + +SOURCE=.\print.c +# End Source File +# Begin Source File + +SOURCE=.\string_to_key.c +# End Source File +# Begin Source File + +SOURCE=.\ud.h +# End Source File +# Begin Source File + +SOURCE=.\util.c +# End Source File +# Begin Source File + +SOURCE=.\Version.c +# End Source File +# End Target +# End Project diff --git a/clients/ud/ud.dsw b/clients/ud/ud.dsw new file mode 100644 index 0000000000..5350cb77ed --- /dev/null +++ b/clients/ud/ud.dsw @@ -0,0 +1,74 @@ +Microsoft Developer Studio Workspace File, Format Version 5.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "liblber"=..\..\libraries\liblber\liblber.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "libldap"=..\..\libraries\libldap\libldap.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "liblutil"=..\..\libraries\liblutil\liblutil.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "ud"=.\ud.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name liblber + End Project Dependency + Begin Project Dependency + Project_Dep_Name libldap + End Project Dependency + Begin Project Dependency + Project_Dep_Name liblutil + End Project Dependency +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/clients/ud/util.c b/clients/ud/util.c index d3a55b99bf..3c63a5f5b8 100644 --- a/clients/ud/util.c +++ b/clients/ud/util.c @@ -36,7 +36,7 @@ extern int debug; char * mygetpass(prompt) char *prompt; { -#if defined(DOS) || defined(VMS) +#if !defined(HAVE_TERMIOS) || !defined(HAVE_SGTTY_H) static char buf[256]; int i, c; -- 2.39.5