~ubuntu-branches/ubuntu/lucid/openssh/lucid

« back to all changes in this revision

Viewing changes to debian/openssh-server.preinst

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2008-09-30 23:09:58 UTC
  • mfrom: (1.13.3 upstream) (29 hardy)
  • mto: This revision was merged to the branch mainline in revision 43.
  • Revision ID: james.westby@ubuntu.com-20080930230958-o6vsgn8c4mm959s0
Tags: 1:5.1p1-3
* Remove unnecessary ssh-vulnkey output in non-verbose mode when no
  compromised or unknown keys were found (closes: #496495).
* Configure with --disable-strip; dh_strip will deal with stripping
  binaries and will honour DEB_BUILD_OPTIONS (thanks, Bernhard R. Link;
  closes: #498681).
* Fix handling of zero-length server banners (thanks, Tomas Mraz; closes:
  #497026).

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
        fi
37
37
}
38
38
 
 
39
prepare_mv_conffile () {
 
40
        CONFFILE="$1"
 
41
        [ -e "$CONFFILE" ] || return 0
 
42
 
 
43
        md5sum="$(md5sum "$CONFFILE" | sed -e 's/ .*//')"
 
44
        old_md5sum="$(dpkg-query -W -f '${Conffiles}\n' openssh-server 2>/dev/null | sed 's/^ *//' | awk '$1 == "'"$CONFFILE"'" { print $2 }')"
 
45
        if [ "$md5sum" = "$old_md5sum" ]; then
 
46
                mv -f "$CONFFILE" "$CONFFILE.dpkg-old"
 
47
        else
 
48
                mv -f "$CONFFILE" "$CONFFILE.moving"
 
49
        fi
 
50
}
 
51
 
39
52
if [ -d /etc/ssh-nonfree ] && [ ! -d /etc/ssh ]; then
40
53
  version=1.2.27
41
54
fi
99
112
    # nonfree ssh-keygen at this point
100
113
    #
101
114
    # First, check if we need to bother
102
 
    echo -en '\0\0' | 3<&0 sh -c \
 
115
    printf '\0\0' | 3<&0 sh -c \
103
116
        'dd if=$key bs=1 skip=32 count=2 2>/dev/null | cmp -s - /dev/fd/3' || {
104
117
      # this means that bytes 32&33 of the key were not both zero, in which
105
118
      # case the key is encrypted, which we need to fix
112
125
  fi
113
126
 
114
127
  if dpkg --compare-versions "$version" lt 0; then
115
 
    CONFFILES="$(dpkg-query -W -f '${Conffiles}\n' ssh | sed 's/^ *//')"
 
128
    CONFFILES="$(dpkg-query -W -f '${Conffiles}\n' ssh 2>/dev/null | sed 's/^ *//')"
116
129
    prepare_transfer_conffile /etc/default/ssh "$ETC_DEFAULT_SSH" 0644
117
130
    prepare_transfer_conffile /etc/init.d/ssh "$ETC_INIT_D_SSH" 0755
118
131
    prepare_transfer_conffile /etc/pam.d/ssh "$ETC_PAM_D_SSH" 0644
119
132
  fi
 
133
 
 
134
  if dpkg --compare-versions "$version" lt 1:4.7p1-4; then
 
135
    prepare_mv_conffile /etc/pam.d/ssh
 
136
  fi
120
137
fi
121
138
 
122
139
#DEBHELPER#