| 1297 | } |
| 1298 | |
| 1299 | static bool accept_connection(rem_port* port, const P_CNCT* cnct) |
| 1300 | { |
| 1301 | /************************************** |
| 1302 | * |
| 1303 | * a c c e p t _ c o n n e c t i o n |
| 1304 | * |
| 1305 | ************************************** |
| 1306 | * |
| 1307 | * Functional description |
| 1308 | * Accept an incoming request for connection. This is purely a lower |
| 1309 | * level handshaking function, and does not constitute the server |
| 1310 | * response for protocol selection. |
| 1311 | * |
| 1312 | **************************************/ |
| 1313 | // Default account to "guest" (in theory all packets contain a name) |
| 1314 | |
| 1315 | string user_name("guest"), host_name; |
| 1316 | |
| 1317 | // Pick up account and host name, if given |
| 1318 | |
| 1319 | ClumpletReader id(ClumpletReader::UnTagged, |
| 1320 | cnct->p_cnct_user_id.cstr_address, |
| 1321 | cnct->p_cnct_user_id.cstr_length); |
| 1322 | |
| 1323 | for (id.rewind(); !id.isEof(); id.moveNext()) |
| 1324 | { |
| 1325 | switch (id.getClumpTag()) |
| 1326 | { |
| 1327 | case CNCT_user: |
| 1328 | id.getString(user_name); |
| 1329 | break; |
| 1330 | |
| 1331 | case CNCT_host: |
| 1332 | id.getString(host_name); |
| 1333 | break; |
| 1334 | |
| 1335 | default: |
| 1336 | break; |
| 1337 | } |
| 1338 | } |
| 1339 | |
| 1340 | #ifndef WIN_NT |
| 1341 | { // scope |
| 1342 | // If the environment variable ISC_INET_SERVER_HOME is set, |
| 1343 | // change the home directory to the specified directory. |
| 1344 | // Note that this will overrule the normal setting of |
| 1345 | // the current directory to the effective user's home directory. |
| 1346 | // This feature was added primarily for testing via remote |
| 1347 | // loopback - but does seem to be of good general use, so |
| 1348 | // is activated for the release version. |
| 1349 | // 1995-February-27 David Schnepper |
| 1350 | |
| 1351 | PathName home; |
| 1352 | if (fb_utils::readenv("ISC_INET_SERVER_HOME", home)) |
| 1353 | { |
| 1354 | if (chdir(home.c_str())) |
| 1355 | { |
| 1356 | gds__log("inet_server: unable to cd to %s errno %d\n", home.c_str(), INET_ERRNO); |
nothing calls this directly
no test coverage detected