From 834224ab85c94d4764d67670a880484ce0785a62 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 19 Jun 2002 13:56:34 +0000 Subject: [PATCH] * uinfo.cc (cygheap_user::ontherange): Call NetUserGetInfo() only with non-NULL logserver parameter. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/uinfo.cc | 42 +++++++++++++++++++---------------------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index bb0c1dc56..08343336e 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2002-06-19 Corinna Vinschen + + * uinfo.cc (cygheap_user::ontherange): Call NetUserGetInfo() only with + non-NULL logserver parameter. + 2002-06-16 Christopher Faylor * cygheap.h (cygheap_user::issetuid): New method. diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index ad61dd3ed..84b8af0c8 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -247,31 +247,27 @@ cygheap_user::ontherange (homebodies what, struct passwd *pw) cygwin_conv_to_full_win32_path (pw->pw_dir, homepath_env_buf); else { - sys_mbstowcs (wuser, name (), sizeof (wuser) / sizeof (*wuser)); - if ((ret = NetUserGetInfo (NULL, wuser, 3, (LPBYTE *)&ui))) + if (env_logsrv ()) { - if (env_logsrv ()) + WCHAR wlogsrv[INTERNET_MAX_HOST_NAME_LENGTH + 3]; + sys_mbstowcs (wlogsrv, env_logsrv (), + sizeof (wlogsrv) / sizeof(*wlogsrv)); + sys_mbstowcs (wuser, name (), sizeof (wuser) / sizeof (*wuser)); + if (!(ret = NetUserGetInfo (wlogsrv, wuser, 3,(LPBYTE *)&ui))) { - WCHAR wlogsrv[INTERNET_MAX_HOST_NAME_LENGTH + 3]; - strcpy (homepath_env_buf, env_logsrv ()); - sys_mbstowcs (wlogsrv, homepath_env_buf, - sizeof (wlogsrv) / sizeof(*wlogsrv)); - ret = NetUserGetInfo (wlogsrv, wuser, 3,(LPBYTE *)&ui); - } - } - if (!ret) - { - char *p; - sys_wcstombs (homepath_env_buf, ui->usri3_home_dir, MAX_PATH); - if (!homepath_env_buf[0]) - { - sys_wcstombs (homepath_env_buf, ui->usri3_home_dir_drive, MAX_PATH); - if (homepath_env_buf[0]) - strcat (homepath_env_buf, "\\"); - else if (!GetSystemDirectory (homepath_env_buf, MAX_PATH)) - strcpy (homepath_env_buf, "c:\\"); - else if ((p = strchr (homepath_env_buf, '\\'))) - p[1] = '\0'; + char *p; + sys_wcstombs (homepath_env_buf, ui->usri3_home_dir, MAX_PATH); + if (!homepath_env_buf[0]) + { + sys_wcstombs (homepath_env_buf, ui->usri3_home_dir_drive, + MAX_PATH); + if (homepath_env_buf[0]) + strcat (homepath_env_buf, "\\"); + else if (!GetSystemDirectory (homepath_env_buf, MAX_PATH)) + strcpy (homepath_env_buf, "c:\\"); + else if ((p = strchr (homepath_env_buf, '\\'))) + p[1] = '\0'; + } } } if (ui)