Changeset 13788 in vbox for trunk/src/libs/xpcom18a4/ipc/ipcd/daemon
- Timestamp:
- Nov 4, 2008 3:22:30 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/ipc/ipcd/daemon/src/ipcdUnix.cpp
r7049 r13788 94 94 ELockFileOpen = -1, 95 95 ELockFileLock = -2, 96 96 ELockFileOwner = -3, 97 97 }; 98 98 … … 113 113 memcpy(lockFile + dirLen + 1, lockName, sizeof(lockName)); 114 114 115 #if 0 116 #ifdef VBOX 117 // 118 // Security checks 119 // 120 struct stat st; 121 if (stat(baseDir, &st) == -1) 122 { 123 printf("Cannot stat '%s'.\n", baseDir); 124 return ELockFileOwner; 125 } 126 127 if (st.st_uid != getuid() && st.st_uid != geteuid()) 128 { 129 printf("Wrong owner (%d) of '%s'.\n", st.st_uid, baseDir); 130 return ELockFileOwner; 131 } 132 133 if (st.st_mode != (__S_IREAD | __S_IWRITE | __S_IEXEC | __S_IFDIR)) 134 { 135 printf("Wrong mode (%o) of '%s'.\n", st.st_mode, baseDir); 136 return ELockFileOwner; 137 } 138 #endif 139 #endif 140 115 141 // 116 142 // open lock file. it remains open until we shutdown. … … 118 144 ipcLockFD = open(lockFile, O_WRONLY|O_CREAT, S_IWUSR|S_IRUSR); 119 145 146 #if 0 147 #ifndef VBOX 120 148 free(lockFile); 149 #endif 150 #endif 121 151 122 152 if (ipcLockFD == -1) 123 153 return ELockFileOpen; 154 155 #if 0 156 #ifdef VBOX 157 // 158 // Security checks 159 // 160 if (fstat(ipcLockFD, &st) == -1) 161 { 162 printf("Cannot stat '%s'.\n", lockFile); 163 free(lockFile); 164 return ELockFileOwner; 165 } 166 167 if (st.st_uid != getuid() && st.st_uid != geteuid()) 168 { 169 printf("Wrong owner (%d) of '%s'.\n", st.st_uid, lockFile); 170 free(lockFile); 171 return ELockFileOwner; 172 } 173 174 if (st.st_mode != (__S_IREAD | __S_IWRITE | __S_IFREG)) 175 { 176 printf("Wrong mode (%o) of '%s'.\n", st.st_mode, lockFile); 177 free(lockFile); 178 return ELockFileOwner; 179 } 180 181 free(lockFile); 182 #endif 183 #endif 124 184 125 185 // … … 434 494 // we terminate 435 495 #ifdef VBOX 436 printf("Cannot create a lock file for '%s'.\n" 437 "Check permissions.\n", addr.local.path); 496 if (status != ELockFileOwner) 497 printf("Cannot create a lock file for '%s'.\n" 498 "Check permissions.\n", addr.local.path); 438 499 #endif 439 500 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.