diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-25 23:23:58 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-25 23:23:58 +0000 |
commit | 6f1713f216fef686a68db5ee02232bc67e525c7d (patch) | |
tree | 256adc75a88723a4b247c32e692d721d65243a82 /libbb/obscure.c | |
parent | 394eebed6656dfc2e56a79500b602023000ac415 (diff) | |
download | busybox-w32-6f1713f216fef686a68db5ee02232bc67e525c7d.tar.gz busybox-w32-6f1713f216fef686a68db5ee02232bc67e525c7d.tar.bz2 busybox-w32-6f1713f216fef686a68db5ee02232bc67e525c7d.zip |
*: intrduce and use safe_gethostname. By Tito <farmatito AT tiscali.it>
safe_gethostname - 48 +48
glob3 35 37 +2
timestamp_and_log 314 315 +1
udhcp_send_kernel_packet 234 231 -3
scan_tree 275 271 -4
passwd_main 1074 1070 -4
print_login_prompt 68 58 -10
obscure 392 377 -15
syslogd_main 882 866 -16
print_login_issue 516 478 -38
hostname_main 278 223 -55
parse_and_put_prompt 825 756 -69
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/9 up/down: 51/-214) Total: -163 bytes
text data bss dec hex filename
798791 728 7484 807003 c505b busybox_old
798631 728 7484 806843 c4fbb busybox_unstripped
Diffstat (limited to 'libbb/obscure.c')
-rw-r--r-- | libbb/obscure.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libbb/obscure.c b/libbb/obscure.c index 5cc906235..1841b27d6 100644 --- a/libbb/obscure.c +++ b/libbb/obscure.c | |||
@@ -93,7 +93,7 @@ static const char *obscure_msg(const char *old_p, const char *new_p, const struc | |||
93 | /* Add 2 for each type of characters to the minlen of password */ | 93 | /* Add 2 for each type of characters to the minlen of password */ |
94 | int size = CONFIG_PASSWORD_MINLEN + 8; | 94 | int size = CONFIG_PASSWORD_MINLEN + 8; |
95 | const char *p; | 95 | const char *p; |
96 | char hostname[255]; | 96 | char *hostname; |
97 | 97 | ||
98 | /* size */ | 98 | /* size */ |
99 | if (!new_p || (length = strlen(new_p)) < CONFIG_PASSWORD_MINLEN) | 99 | if (!new_p || (length = strlen(new_p)) < CONFIG_PASSWORD_MINLEN) |
@@ -108,12 +108,11 @@ static const char *obscure_msg(const char *old_p, const char *new_p, const struc | |||
108 | return "similar to gecos"; | 108 | return "similar to gecos"; |
109 | } | 109 | } |
110 | /* hostname as-is, as sub-string, reversed, capitalized, doubled */ | 110 | /* hostname as-is, as sub-string, reversed, capitalized, doubled */ |
111 | if (gethostname(hostname, 255) == 0) { | 111 | hostname = safe_gethostname(); |
112 | hostname[254] = '\0'; | 112 | i = string_checker(new_p, hostname); |
113 | if (string_checker(new_p, hostname)) { | 113 | free(hostname); |
114 | return "similar to hostname"; | 114 | if (i) |
115 | } | 115 | return "similar to hostname"; |
116 | } | ||
117 | 116 | ||
118 | /* Should / Must contain a mix of: */ | 117 | /* Should / Must contain a mix of: */ |
119 | for (i = 0; i < length; i++) { | 118 | for (i = 0; i < length; i++) { |