mirror of https://github.com/perkeep/perkeep.git
3ec58472db
When you go to /setup on Windows, it currently checks the "localhostAuthorized" function that checks your UserID with os.Getuid() and than check with the local and remote address to see if you are allow. In Windows os.Getuid will always equals -1 and the function default to unallowed. On darwin, it does check for uid but afterward only cares if the local and remote addresses are loopback addresses. So, I changed this function so that when the os.Getuid is not avalaible on the platform and returns -1, it does the same check as in darwin. I also modified the "isLocalhost" function to use the helper function "net.IsLoopback" instead of string matching. Since, I already had parsed addresses and had to call AddPairUserId, I checked if it wouldn't be simpler to pass net.Addr directly instead of strings and reconvert them afterward. It seemed after looking at all the code that called this function that it simplified calls quite a bit to do so. Finally, I modified "netutil.Localhost" for it to return the first IP it finds instead of the string representation of the first IP enclosed in square brackets. Since the square brackets around the IP are only necessary in a TCPAddr, it would be simplier and more robust for the user to directly print TCPAddr instead of appending this string to a post. Change-Id: Id79de6bebd6380f877074211c0d260782058765f |
||
---|---|---|
.. | ||
ident.go | ||
ident_test.go |