diff options
Diffstat (limited to 'contrib/cygwin')
-rw-r--r-- | contrib/cygwin/ssh-host-config | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/contrib/cygwin/ssh-host-config b/contrib/cygwin/ssh-host-config index e9c56aea9..c69cfd88b 100644 --- a/contrib/cygwin/ssh-host-config +++ b/contrib/cygwin/ssh-host-config | |||
@@ -468,19 +468,21 @@ then | |||
468 | fi | 468 | fi |
469 | 469 | ||
470 | # Care for services file | 470 | # Care for services file |
471 | _my_etcdir="/ssh-host-config.$$" | ||
471 | if [ $_nt -gt 0 ] | 472 | if [ $_nt -gt 0 ] |
472 | then | 473 | then |
473 | _wservices="${SYSTEMROOT}\\system32\\drivers\\etc\\services" | 474 | _win_etcdir="${SYSTEMROOT}\\system32\\drivers\\etc" |
474 | _wserv_tmp="${SYSTEMROOT}\\system32\\drivers\\etc\\srv.out.$$" | 475 | _services="${_my_etcdir}/services" |
475 | else | 476 | else |
476 | _wservices="${WINDIR}\\SERVICES" | 477 | _win_etcdir="${WINDIR}" |
477 | _wserv_tmp="${WINDIR}\\SERV.$$" | 478 | _services="${_my_etcdir}/SERVICES" |
478 | fi | 479 | fi |
479 | _services=`cygpath -u "${_wservices}"` | 480 | _serv_tmp="${_my_etcdir}/srv.out.$$" |
480 | _serv_tmp=`cygpath -u "${_wserv_tmp}"` | ||
481 | 481 | ||
482 | mount -t -f "${_wservices}" "${_services}" | 482 | mount -t -f "${_win_etcdir}" "${_my_etcdir}" |
483 | mount -t -f "${_wserv_tmp}" "${_serv_tmp}" | 483 | |
484 | # Depends on the above mount | ||
485 | _wservices=`cygpath -w "${_services}"` | ||
484 | 486 | ||
485 | # Remove sshd 22/port from services | 487 | # Remove sshd 22/port from services |
486 | if [ `grep -q 'sshd[ \t][ \t]*22' "${_services}"; echo $?` -eq 0 ] | 488 | if [ `grep -q 'sshd[ \t][ \t]*22' "${_services}"; echo $?` -eq 0 ] |
@@ -490,13 +492,13 @@ then | |||
490 | then | 492 | then |
491 | if mv "${_serv_tmp}" "${_services}" | 493 | if mv "${_serv_tmp}" "${_services}" |
492 | then | 494 | then |
493 | echo "Removing sshd from ${_services}" | 495 | echo "Removing sshd from ${_wservices}" |
494 | else | 496 | else |
495 | echo "Removing sshd from ${_services} failed\!" | 497 | echo "Removing sshd from ${_wservices} failed\!" |
496 | fi | 498 | fi |
497 | rm -f "${_serv_tmp}" | 499 | rm -f "${_serv_tmp}" |
498 | else | 500 | else |
499 | echo "Removing sshd from ${_services} failed\!" | 501 | echo "Removing sshd from ${_wservices} failed\!" |
500 | fi | 502 | fi |
501 | fi | 503 | fi |
502 | 504 | ||
@@ -508,18 +510,17 @@ then | |||
508 | then | 510 | then |
509 | if mv "${_serv_tmp}" "${_services}" | 511 | if mv "${_serv_tmp}" "${_services}" |
510 | then | 512 | then |
511 | echo "Added ssh to ${_services}" | 513 | echo "Added ssh to ${_wservices}" |
512 | else | 514 | else |
513 | echo "Adding ssh to ${_services} failed\!" | 515 | echo "Adding ssh to ${_wservices} failed\!" |
514 | fi | 516 | fi |
515 | rm -f "${_serv_tmp}" | 517 | rm -f "${_serv_tmp}" |
516 | else | 518 | else |
517 | echo "Adding ssh to ${_services} failed\!" | 519 | echo "Adding ssh to ${_wservices} failed\!" |
518 | fi | 520 | fi |
519 | fi | 521 | fi |
520 | 522 | ||
521 | umount "${_services}" | 523 | umount "${_my_etcdir}" |
522 | umount "${_serv_tmp}" | ||
523 | 524 | ||
524 | # Care for inetd.conf file | 525 | # Care for inetd.conf file |
525 | _inetcnf="${SYSCONFDIR}/inetd.conf" | 526 | _inetcnf="${SYSCONFDIR}/inetd.conf" |