mwiede / jsch

fork of the popular jsch library
Other
664 stars 124 forks source link

Connecting to Euler server, executing write and execute scripts in one connection, memory error #495

Open haodeyu opened 4 months ago

haodeyu commented 4 months ago

After connecting to the Euler server through version 0.2.4 of com. github. mwiede. jsch in Java, Scenario reproduction: Writing the content script to the server to generate the script, while executing the script, will throw free(): invalid next size (fast)

Aborted (core dumped) error, but writing the script first, reconnecting, and then executing the script will not result in an error. The following is the script content:

String c = "function root_login_deny {\n" + "SSHSTATUS=ps -ef|grep -i sshd|grep -v grep|wc -l\n" + "if [ x"$SSHSTATUS" != "x0" ];\n" + "then if [[ cat /etc/ssh/sshd_config|grep \"^PermitRootLogin\" |awk '{print $2}'|grep -iw \"no\"|wc -l != 0 ]];\n" + " then cat /etc/ssh/sshd_config|grep "^PermitRootLogin";\n" + " echo "This device does not permit root to ssh login,check result:true";\n" + " else echo "This device permits root to ssh login,check result:false" ;\n" + " fi\n" + "else echo "The ssh service of device is not running,check result:true";\n" + "fi;unset SSHSTATUS\n" + "if [ "$(which netstat 2>/dev/null)"x != ""x ];then\n" + " TELSTATUS=netstat -tlnp|awk '$4~/:23$/{print $0}'|wc -l\n" + "else [ "$(which ss 2>/dev/null)"x != ""x ] && TELSTATUS=ss -tlnp|awk '$4~/:23$/{print $0}'|wc -l;fi\n" + "if [ x"{TELSTATUS:=0}" != "x0" ];then\n" + " if ([ -f /etc/securetty ] && [ "x (grep ^pts /etc/securetty|wc -l)" = "x0" ]);then\n" + " echo "This device does not permit root to telnet login,check result:true";\n" + " else\n" + " echo "This device permits root to telnet login,check result:false";fi\n" + "else echo "The telnet service of device is not running,check result:true";\n" + "fi;unset TELSTATUS\n" + "}\n" + "root_login_deny;unset root_login_deny";

norrisjeremy commented 4 months ago

Hi @haodeyu,

The issue you described sounds like some sort of problem with the server software, not JSch. I'm not sure what assistance we can provide you?

Thanks, Jeremy