Tcl Source Code

Check-in [d6a73c524c]
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:[9e6b569963] win: if user specified without domain (and local user was not found), try to resolve user-home using current domain, so following code's are similar: file normalize ~$::tcl_platform(user)@$::env(USERDOMAIN) file normalize ~$::tcl_platform(user)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sebres-bug-9e6b569963-8-5-branch
Files: files | file ages | folders
SHA3-256: d6a73c524c40ff07ae0b237c4b54f09ba2305ff7737946fc2ad79b75ac622adb
User & Date: sebres 2018-05-24 20:49:12
References
2018-05-24
20:58 Ticket [9e6b569963] file normalize ~user fails on Windows status still Open with 3 other changes artifact: 5c7c330198 user: sebres
Context
2018-05-25
10:04
merge/reintegrate test-cases from bug-9e6b569963 check-in: 617e292a69 user: sebres tags: sebres-bug-9e6b569963-8-5-branch
2018-05-24
20:49
[9e6b569963] win: if user specified without domain (and local user was not found), try to resolve us... check-in: d6a73c524c user: sebres tags: sebres-bug-9e6b569963-8-5-branch
20:20
fixed typo in winFCmd-12.6.2: unneeded extra-bracket removed check-in: 634425a216 user: sebres tags: core-8-5-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to win/tclWinFile.c.

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
1471
1472












1473
1474
1475
1476
1477
1478
1479
		GetProcAddress(netapiInst, "NetGetDCName");
	netUserGetInfoProc = (NETUSERGETINFOPROC *)
		GetProcAddress(netapiInst, "NetUserGetInfo");
	getProfilesDirectoryProc = (GETPROFILESDIRECTORYPROC *)
		GetProcAddress(userenvInst, "GetProfilesDirectoryW");
	if ((netUserGetInfoProc != NULL) && (netGetDCNameProc != NULL)
		&& (netApiBufferFreeProc != NULL) && (getProfilesDirectoryProc != NULL)) {
	    USER_INFO_1 *uiPtr, **uiPtrPtr = &uiPtr;
	    Tcl_DString ds;
	    int nameLen, badDomain;
	    char *domain;
	    WCHAR *wName, *wHomeDir, *wDomain;
	    WCHAR buf[MAX_PATH];

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












		    DWORD i, size = MAX_PATH;
		    wHomeDir = uiPtr->usri1_home_dir;
		    if ((wHomeDir != NULL) && (wHomeDir[0] != L'\0')) {
			size = lstrlenW(wHomeDir);
			Tcl_UniCharToUtfDString(wHomeDir, size, bufferPtr);
		    } else {
			/*






|

|




|






|
<



|


|
|
>
>
>
>
>
>
>
>
>
>
>
>







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
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
		GetProcAddress(netapiInst, "NetGetDCName");
	netUserGetInfoProc = (NETUSERGETINFOPROC *)
		GetProcAddress(netapiInst, "NetUserGetInfo");
	getProfilesDirectoryProc = (GETPROFILESDIRECTORYPROC *)
		GetProcAddress(userenvInst, "GetProfilesDirectoryW");
	if ((netUserGetInfoProc != NULL) && (netGetDCNameProc != NULL)
		&& (netApiBufferFreeProc != NULL) && (getProfilesDirectoryProc != NULL)) {
	    USER_INFO_1 *uiPtr;
	    Tcl_DString ds;
	    int nameLen, rc;
	    char *domain;
	    WCHAR *wName, *wHomeDir, *wDomain;
	    WCHAR buf[MAX_PATH];

	    rc = 0;
	    nameLen = -1;
	    wDomain = NULL;
	    domain = strchr(name, '@');
	    if (domain != NULL) {
		Tcl_DStringInit(&ds);
		wName = Tcl_UtfToUniCharDString(domain + 1, -1, &ds);
		rc = (netGetDCNameProc)(NULL, wName, (LPBYTE *) &wDomain);

		Tcl_DStringFree(&ds);
		nameLen = domain - name;
	    }
	    if (rc == 0) {
		Tcl_DStringInit(&ds);
		wName = Tcl_UtfToUniCharDString(name, nameLen, &ds);
		while ((netUserGetInfoProc)(wDomain, wName, 1,
			(LPBYTE *) &uiPtr) != 0) {
		    /* 
		     * user does not exists - if domain was not specified,
		     * try again using current domain.
		     */
		    rc = 1;
		    if (domain != NULL) break;
		    /* get current domain */
		    rc = (netGetDCNameProc)(NULL, NULL, (LPBYTE *) &wDomain);
		    if (rc != 0) break;
		    domain = INT2PTR(-1); /* repeat once */
		}
		if (rc == 0) {
		    DWORD i, size = MAX_PATH;
		    wHomeDir = uiPtr->usri1_home_dir;
		    if ((wHomeDir != NULL) && (wHomeDir[0] != L'\0')) {
			size = lstrlenW(wHomeDir);
			Tcl_UniCharToUtfDString(wHomeDir, size, bufferPtr);
		    } else {
			/*