Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(835)

Unified Diff: src/tcs/rpc/tcstp/rpc.c

Issue 3958001: Change to use a unix socket instead of TCP. (Closed) Base URL: http://git.chromium.org/git/trousers.git
Patch Set: Use a constant for the socket name. Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/include/tcsd.h ('k') | src/tcsd/svrside.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/tcs/rpc/tcstp/rpc.c
diff --git a/src/tcs/rpc/tcstp/rpc.c b/src/tcs/rpc/tcstp/rpc.c
index ca1a4df62adec7aa365669c17d614a1a8fa0383b..6a78840894d47b8075028add6fb314745bfe5e13 100644
--- a/src/tcs/rpc/tcstp/rpc.c
+++ b/src/tcs/rpc/tcstp/rpc.c
@@ -516,50 +516,8 @@ DispatchTable tcs_func_table[TCSD_MAX_NUM_ORDS] = {
int
access_control(struct tcsd_thread_data *thread_data)
{
- int i = 0;
- struct hostent *local_hostent = NULL;
- static char *localhostname = NULL;
- static int localhostname_len = 0;
-
- if (!localhostname) {
- if ((local_hostent = gethostbyname("localhost")) == NULL) {
- LogError("Error resolving localhost: %s", hstrerror(h_errno));
- return 1;
- }
-
- LogDebugFn("Cached local hostent:");
- LogDebugFn("h_name: %s", local_hostent->h_name);
- for (i = 0; local_hostent->h_aliases[i]; i++) {
- LogDebugFn("h_aliases[%d]: %s", i, local_hostent->h_aliases[i]);
- }
- LogDebugFn("h_addrtype: %s",
- (local_hostent->h_addrtype == AF_INET6 ? "AF_INET6" : "AF_INET"));
-
- localhostname_len = strlen(local_hostent->h_name);
- if ((localhostname = strdup(local_hostent->h_name)) == NULL) {
- LogError("malloc of %d bytes failed.", localhostname_len);
- return TCSERR(TSS_E_OUTOFMEMORY);
- }
- }
-
- /* if the request comes from localhost, or is in the accepted ops list,
- * approve it */
- if (!strncmp(thread_data->hostname, localhostname,
- MIN((size_t)localhostname_len, strlen(thread_data->hostname)))) {
- return 0;
- } else {
- while (tcsd_options.remote_ops[i]) {
- if ((UINT32)tcsd_options.remote_ops[i] == thread_data->comm.hdr.u.ordinal) {
- LogInfo("Accepted %s operation from %s",
- tcs_func_table[thread_data->comm.hdr.u.ordinal].name,
- thread_data->hostname);
- return 0;
- }
- i++;
- }
- }
-
- return 1;
+ // Unix domain socket, so just allow
+ return 0;
}
TSS_RESULT
« no previous file with comments | « src/include/tcsd.h ('k') | src/tcsd/svrside.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698