Tcl Source Code

Check-in [38bcab5c78]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix [9e6b569963]: file normalize ~user fails on Windows
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bug-9e6b569963
Files: files | file ages | folders
SHA3-256: 38bcab5c78a186648480287cb3f58a7b8f2cc6afcd745f455513b0fdd1192a7a
User & Date: fvogel 2018-05-18 19:54:56
Context
2018-05-19
07:10
Add test filesystem-1.30.2 {normalisation of nonexistent user specified as [email protected]} check-in: 9d50014a1e user: fvogel tags: bug-9e6b569963
2018-05-18
19:54
Fix [9e6b569963]: file normalize ~user fails on Windows check-in: 38bcab5c78 user: fvogel tags: bug-9e6b569963
06:18
Add test filesystem-1.30.1 checking file normalize ~$::tcl_platform(user). This test should currentl... check-in: ffd0f31dba user: fvogel tags: bug-9e6b569963
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to win/tclWinFile.c.

1440
1441
1442
1443
1444
1445
1446

1447
1448
1449
1450
1451
1452
1453
....
1454
1455
1456
1457
1458
1459
1460

1461
1462
1463
1464
1465
1466
1467
1468
    USER_INFO_1 *uiPtr, **uiPtrPtr = &uiPtr;
    Tcl_DString ds;
    int nameLen = -1;
    int badDomain = 0;
    char *domain;
    WCHAR *wName, *wHomeDir, *wDomain, **wDomainPtr = &wDomain;
    WCHAR buf[MAX_PATH];


    Tcl_DStringInit(bufferPtr);
    wDomain = NULL;
    domain = strchr(name, '@');
    if (domain != NULL) {
	Tcl_DStringInit(&ds);
	wName = Tcl_UtfToUniCharDString(domain + 1, -1, &ds);
................................................................................
	badDomain = NetGetDCName(NULL, wName, (LPBYTE *) wDomainPtr);
	Tcl_DStringFree(&ds);
	nameLen = domain - name;
    }
    if (badDomain == 0) {
	Tcl_DStringInit(&ds);
	wName = Tcl_UtfToUniCharDString(name, nameLen, &ds);

	if (NetUserGetInfo(wDomain, wName, 1, (LPBYTE *) uiPtrPtr) == 0) {
	    wHomeDir = uiPtr->usri1_home_dir;
	    if ((wHomeDir != NULL) && (wHomeDir[0] != L'\0')) {
		Tcl_UniCharToUtfDString(wHomeDir, lstrlenW(wHomeDir),
			bufferPtr);
	    } else {
		/*
		 * User exists but has no home dir. Return






>







 







>
|







1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
....
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
    USER_INFO_1 *uiPtr, **uiPtrPtr = &uiPtr;
    Tcl_DString ds;
    int nameLen = -1;
    int badDomain = 0;
    char *domain;
    WCHAR *wName, *wHomeDir, *wDomain, **wDomainPtr = &wDomain;
    WCHAR buf[MAX_PATH];
    LPCWSTR wServername = NULL;

    Tcl_DStringInit(bufferPtr);
    wDomain = NULL;
    domain = strchr(name, '@');
    if (domain != NULL) {
	Tcl_DStringInit(&ds);
	wName = Tcl_UtfToUniCharDString(domain + 1, -1, &ds);
................................................................................
	badDomain = NetGetDCName(NULL, wName, (LPBYTE *) wDomainPtr);
	Tcl_DStringFree(&ds);
	nameLen = domain - name;
    }
    if (badDomain == 0) {
	Tcl_DStringInit(&ds);
	wName = Tcl_UtfToUniCharDString(name, nameLen, &ds);
        NetGetDCName(NULL, wDomain, (LPBYTE *) &wServername);
	if (NetUserGetInfo(wServername, wName, 1, (LPBYTE *) uiPtrPtr) == 0) {
	    wHomeDir = uiPtr->usri1_home_dir;
	    if ((wHomeDir != NULL) && (wHomeDir[0] != L'\0')) {
		Tcl_UniCharToUtfDString(wHomeDir, lstrlenW(wHomeDir),
			bufferPtr);
	    } else {
		/*
		 * User exists but has no home dir. Return