Commit Graph
67 Commits
Author SHA1 Message Date
George Fleming 2de4fe9be6 Adding new isSymLink() function 2015-10-30 11:47:44 -07:00
George Fleming 3a02f1b3a0 Change /bin/hostname to just hostname, and let sh figure out the path 2015-10-29 08:47:36 -07:00
George Fleming 2eaf911346 Add new getfullyqualifiedname test 2015-10-28 16:42:15 -07:00
George Fleming 1759f9a2f6 Changes per Zack comments 2015-10-27 15:33:25 -07:00
George Fleming 9718cd02ab Remove W suffix of native function 2015-10-27 10:48:31 -07:00
George Fleming 845c4483b6 Simpliefied GetComputerName 2015-10-27 09:19:41 -07:00
Andrew Schwartzmeyer c6ca4db6a4 Output psnative and pshost to monad-linux/bin
But leave test artifacts in monad-native.
2015-10-25 17:59:14 -07:00
Andrew Schwartzmeyer af813b9a08 Enable unit testing via CMake 2015-10-25 12:49:19 -07:00
Andrew Schwartzmeyer 569de14c1e Rename libps to libpsnative
And impl to native
2015-10-25 12:21:53 -07:00
Andrew Schwartzmeyer 659ca235a7 Merge branch 'dev/HardLink-Native' into dev/username 2015-10-25 12:12:35 -07:00
Andrew Schwartzmeyer 807760f06d Remove deprecated GetCPInfo code 2015-10-25 12:06:47 -07:00
Andrew Schwartzmeyer 81984534b8 Refactor CMake build system and host files
Use CMakeLists.txt file for each directory. Setup to be consumed by
monad-linux's CMake. Utilize GoogleTest's CMake. Refactor host files
layout.
2015-10-25 12:03:49 -07:00
Andrew Schwartzmeyer 5ed81a0a41 Return char* for GetUserName
The UTF-8 char* is marshaled to a UTF-16 string automatically. It must
be allocated on the heap as the CLR will free the returned memory.

This removes entire classes of possible errors, greatly reducing the
code complexity and number of tests.
2015-10-24 22:17:44 -07:00
Andrew Schwartzmeyer b91c117313 GetLinkCount is not Unicode 2015-10-24 21:30:42 -07:00
George Fleming cf9b390faa Adding native tests 2015-10-23 15:48:48 -07:00
Andrew Schwartzmeyer 556f423aa7 Remove deprecated hostutil and tests 2015-10-23 00:57:17 -07:00
Andrew Schwartzmeyer 020a768c31 Use getpwuid(geteuid()) instead of getlogin()
This removes the dependency on a TTY and now does what is expected: gets
the (possibly impersonated) username of the current process/thread.

Implementation and tests updated, still uses reentrant versions where possible.
2015-09-23 15:57:23 -07:00
Andrew Schwartzmeyer 39174a0afb Fix GetCpInfo
- Move cpinfo related code out of pal.h and into getcpinfo.h
- Use static cpinfo struct (not pointer) in test and pass address
- Whitespace cleanup
2015-08-28 15:59:31 -07:00
Aaron 6753151161 Got rid of warnings from cpinfo struct 2015-08-28 15:44:04 -07:00
Aaron 4762820519 Get rid of merge conflict 2015-08-26 13:03:51 -07:00
Aaron 805394e423 Got rid of merge conflict 2015-08-26 09:28:48 -07:00
Aaron 8080e53786 made changes based on feedback from pull request 2015-08-25 13:47:39 -07:00
Aaron Katz aba54f074d Merge pull request 102 from dev/9-getcomputername into develop 2015-08-21 16:56:54 +00:00
Aaron 23ad440cfc made changes based on feedback from pull request 2015-08-21 09:55:39 -07:00
Aaron 50f9af1bd3 changes back on feedback from pull request 2015-08-20 14:40:02 -07:00
Aaron e4fd76b739 Added changed from feedback from Andy 2015-08-17 17:02:40 -07:00
Aaron d7355a0572 implemented suggested changes based off of feedback 2015-08-14 12:26:15 -07:00
Aaron 4f62559eaf Merge remote-tracking branch 'origin/develop' into dev/8-getcpinfo 2015-08-14 11:34:48 -07:00
Aaron 1a796b5924 Changes to make converting beteween UTF8 and UTF16 2015-08-14 10:51:25 -07:00
Aaron 53e7c11e69 Added changes based of feedback from Peter 2015-08-14 09:26:45 -07:00
Andrew Schwartzmeyer d298302e8c Use libicu properly in tests 2015-08-13 21:34:59 -07:00
Andrew Schwartzmeyer fc8f5d18c4 Use 0 instead of '\0'
To be consistent with tests
2015-08-13 20:32:30 -07:00
Aaron 72ea5abd0b New line for { 2015-08-13 10:53:09 -07:00
Aaron 1b537f0c8f Changed based of feedback 2015-08-13 10:48:38 -07:00
Aaron f496f91af0 Added changes to code based on additional documention and using a 16 bit string 2015-08-13 09:47:10 -07:00
Aaron 01f85ecf1c Fixed Merge Confilct with CMakeLists.txt 2015-08-12 14:04:39 -07:00
Andrew Schwartzmeyer 9a42b894f2 Convert to Allman style with 4-space indentation 2015-08-07 18:43:58 -07:00
Andrew Schwartzmeyer f8e9dfde8c Fix style issues
- Use Doxygen style comments (with better comments)
- Use `type* ident` instead of `type *ident`
- Start { on new lines
- Use TRUE/FALSE from PAL.H
2015-08-07 12:03:31 -07:00
Andrew Schwartzmeyer b379fb4a6b Rename to GetUserNameW since it is Unicode 2015-08-06 16:28:29 -07:00
Aaron 316cabbdcf Got rid of tests for UTF7, added error checking, adding test to check for null paramater for codepage 2015-08-06 10:16:13 -07:00
Aaron 8bf19f7144 updates to CMakeFile.txt 2015-08-05 13:28:12 -07:00
Andrew Schwartzmeyer 447896aede Use WCHAR sizes instead of CHAR sizes
Such that lpnSize is the length (number of UTF-16 characters, including
null) of the username. Must be multiplied by sizeof(char16_t) for bytes.
2015-08-04 18:31:54 -07:00
Aaron 54618f1750 Made changes based off feedback from Peter. Also added more unit tests 2015-08-04 14:38:53 -07:00
Andrew Schwartzmeyer e64c8961c9 Update GetUserName tests
Note that these fail when run in a Docker container because a) the
current container's locale is not completely set, and b) getlogin()
returns null with ENOENT since /var/run/utmp is being mapped to the
host, and thus denied access from within the container.

The container needs the locale set and its own /run/utmp, see
https://lists.linuxcontainers.org/pipermail/lxc-users/2011-July/002374.html
2015-08-04 14:16:57 -07:00
Aaron c979881804 added more error handling 2015-08-03 13:54:07 -07:00
Andrew Schwartzmeyer 0c9fb0d01b Rename userName in test to expectedUsername
To clarify that it is for comparison; not the result of GetUserName.
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer 9426e9c455 Use LOGIN_NAME_MAX instead of L_cuserid
Since L_cuserid is only for cuserid, not getlogin_r

Unit test for L_cuserid removed because the macro may not be available
on all platforms.
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer cbee353d0d Add more unit test coverage for GetUserName 2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer 0f07a65f50 Use test fixture in GetUserName unit tests 2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer e8cb7e24fe Use L_cuserid instead of 64 and given lpnSize 2015-08-03 13:00:34 -07:00