1 Star 0 Fork 7

src-oepkgs-oE-rv/yp-tools

forked from src-openEuler/yp-tools 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
yp-tools-2.12-crypt.patch 1.33 KB
一键复制 编辑 原始数据 按行查看 历史
hexiaowen 提交于 2019-09-30 11:20 . Package init
diff -up yp-tools-2.12/src/yppasswd.c.crypt yp-tools-2.12/src/yppasswd.c
--- yp-tools-2.12/src/yppasswd.c.crypt 2012-04-23 13:01:35.599721168 +0200
+++ yp-tools-2.12/src/yppasswd.c 2012-04-23 13:16:18.251261293 +0200
@@ -772,9 +778,16 @@ main (int argc, char **argv)
{
int passwdlen = get_passwd_len (pwd->pw_passwd);
char *sane_passwd = alloca (passwdlen + 1);
+ char *crypted;
strncpy (sane_passwd, pwd->pw_passwd, passwdlen);
sane_passwd[passwdlen] = 0;
- if (strcmp (crypt (s, sane_passwd), sane_passwd))
+ crypted = crypt (s, sane_passwd);
+ if(crypted == NULL)
+ {
+ fprintf (stderr, _("Sorry - crypt() failed.\n"));
+ return 1;
+ }
+ if (strcmp (crypted, sane_passwd))
{
fprintf (stderr, _("Sorry.\n"));
return 1;
@@ -789,6 +802,7 @@ main (int argc, char **argv)
char *error_msg;
#endif /* USE_CRACKLIB */
char *buf, salt[37], *p = NULL;
+ char *crypted;
int tries = 0;
buf = (char *) malloc (129);
@@ -869,7 +883,13 @@ main (int argc, char **argv)
break;
}
- yppwd.newpw.pw_passwd = strdup (crypt (buf, salt));
+ crypted = crypt (buf, salt);
+ if(crypted == NULL) {
+ fprintf (stderr, _("Sorry - crypt() failed.\n"));
+ return 1;
+ } else {
+ yppwd.newpw.pw_passwd = strdup (crypted);
+ }
}
if (f_flag)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-oepkgs-oe-rv/yp-tools.git
[email protected]:src-oepkgs-oe-rv/yp-tools.git
src-oepkgs-oe-rv
yp-tools
yp-tools
master

搜索帮助