Aaron
e10abd1971
Fixed Merge Confilct with CMakeLists.txt
2015-08-12 14:04:39 -07:00
Aaron
6fc54d4e42
changes to pal.h
2015-08-12 13:56:55 -07:00
Andrew Schwartzmeyer
a99c56eea3
Convert to Allman style with 4-space indentation
2015-08-07 18:43:58 -07:00
Andrew Schwartzmeyer
f35efda7e7
Add -Wall to CMAKE_CXX_FLAGS
2015-08-07 12:07:19 -07:00
Andrew Schwartzmeyer
467fdeeb0c
Map getlogin_r()'s ERANGE to ERROR_GEN_FAILURE
...
ERROR_INSUFFICIENT_BUFFER should never occur here and would be a
misleading error for the user.
2015-08-07 12:05:07 -07:00
Andrew Schwartzmeyer
062eb5a7b4
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
1b18bfd5e1
Clean up CMakeLists
2015-08-06 17:03:53 -07:00
Andrew Schwartzmeyer
afab62205a
Rename to GetUserNameW since it is Unicode
2015-08-06 16:28:29 -07:00
Andrew Schwartzmeyer
2ec0c2996f
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
9ff9a88279
Made changes based off feedback from Peter. Also added more unit tests
2015-08-04 14:38:53 -07:00
Andrew Schwartzmeyer
7d007d6708
Remove PAL submodule
2015-08-04 14:16:57 -07:00
Andrew Schwartzmeyer
b77b0a7e6c
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
Andrew Schwartzmeyer
052ecc801d
Use icu for Unicode conversion and fix lpnSize
...
A careful reading of the GetUserName documentation and Windows Data
Types says that lpnSize is "the number of TCHARs copied to the
buffer...including the terminating null character," and a TCHAR in this
environment is a CHAR because we assume UNICODE is always defined for
CoreCLR. A CHAR is a byte. So lpSize is number of bytes, not number of
UTF-16 characters as we previously believed.
2015-08-04 14:16:49 -07:00
Andrew Schwartzmeyer
84d24589be
Link ps against icu instead of scxcore
...
Remove scxcore library from CMake
2015-08-04 14:14:07 -07:00
Aaron
245b287443
added more error handling
2015-08-03 13:54:07 -07:00
Andrew Schwartzmeyer
011d8f41ea
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
d589ac1cbf
Refactor setting of lpnSize when buffer size is insufficient
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
865fd0a56b
Remove unnecessary static qualifier from const string
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
b36cdcdc12
Use std::string instead of C99 dynamic array
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
bb8d0b793e
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
e2d4ce0ab1
Add more unit test coverage for GetUserName
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
876a88c7d8
Set lpnSize when insufficient
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
edcb8b0402
Use test fixture in GetUserName unit tests
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
59eb8a5799
Use L_cuserid instead of 64 and given lpnSize
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
097d2e3821
Factor out using directives
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
14cec68d08
Change global to local static const
...
To avoid polluting the global namespace without using a namespace.
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
80f8fff6f2
Clarify lpBuffer layout in GetUserName unit test
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
00390847e6
Convert get_login_r to UTF-16 and return
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
e14934d06d
Check for invalid parameters in GetUserName
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
69bfc8906b
Explain GetUserName signature
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
5f54d0c748
Test UTF-16 output of GetUserName
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
0d9d31d5bd
Link scxcore to ps and include headers
2015-08-03 13:00:34 -07:00
Andrew Schwartzmeyer
c8fa215261
Add ext-pal dependency
...
Static library and header pulled from a build of the PAL on Ubuntu
14.04. Ugly workaround, but much easier than incorporating that entire
project's build system, or even just a part of it.
2015-08-03 12:58:59 -07:00
Andrew Schwartzmeyer
95c6658178
Add unit test for GetUserName
2015-08-03 12:58:59 -07:00
Andrew Schwartzmeyer
83d2162dc1
Use getlogin_r() in GetUserName and map errno
2015-08-03 12:53:39 -07:00
Andrew Schwartzmeyer
197938c6a6
Check locale in GetUserName
2015-08-03 12:53:39 -07:00
Andrew Schwartzmeyer
61b4e5513a
Update GetUserName signature
2015-08-03 12:53:39 -07:00
Aaron
530c6883f8
Add error handing for bad enivronment and bad parameter
2015-08-03 10:48:46 -07:00
Aaron
f90c8be0ef
Merge remote-tracking branch 'origin/develop' into dev/9-getcomputername
...
Conflicts:
src/CMakeLists.txt
2015-07-31 14:59:13 -07:00
Aaron
da4d4d7a21
Added test for buffer not having enough space to write computer name
2015-07-30 13:47:31 -07:00
Aaron
385fb20cdf
Added failure casex
2015-07-30 12:47:10 -07:00
Aaron
bf92f710e8
Added case for failure
2015-07-30 12:46:28 -07:00
Aaron
920322c809
Added ERROR_BUFFER_OVERFLOW
2015-07-30 12:44:48 -07:00
Peter Honeder
c1c9a99269
added hostutil.h, added tests for hostutil, added more cmdline options to PS host
2015-07-30 16:53:35 +02:00
Peter Honeder
8e18abaf31
added interpreting the verbose option
2015-07-29 18:12:31 +02:00
Peter Honeder
d09ac28b73
fixed string termination issue, added verbose mode
2015-07-28 18:49:32 +02:00
Peter Honeder
0a31659271
cleaned up implementation, added command line parsing and standardized managed interface for cmdline hosts
2015-07-28 18:28:09 +02:00
Peter Honeder
f7396c9561
renamed function pointer type, changed code to call UnmanagedMain
2015-07-27 18:40:33 +02:00
Peter Honeder
3711159996
added first version of custom PS hosting code
2015-07-27 17:40:14 +02:00
Peter Honeder
a756ecaadf
added pinvoke functions to query terminal size
2015-07-07 18:04:23 -07:00