Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shell默认密码和用户逻辑可否提供一个接口出来; #206

Closed
Esonfu opened this issue Jan 3, 2025 · 2 comments
Closed

shell默认密码和用户逻辑可否提供一个接口出来; #206

Esonfu opened this issue Jan 3, 2025 · 2 comments

Comments

@Esonfu
Copy link

Esonfu commented Jan 3, 2025

如果用户 设置了密码和用户名,就采用用户的 如果没有就采用默认的。

@NevermindZZT
Copy link
Owner

@Esonfu
Copy link
Author

Esonfu commented Jan 3, 2025

我这里应用环境是web服务器的密码要和shell(telnet和com)密码同步 web修改用户名后shell 也的改。我这里投机取巧了 我定义了ShellCommand

ShellCommand userCommand;
void userShellInit(void)
{  
    userCommand.data.user.name = shell_user;
    userCommand.data.user.password = shell_password;
    shell.info.user = &userCommand;
}

然后就将您的 shell.c -> void shellInit(Shell *shell, char *buffer, unsigned short size) ->shellSetUser(shell, &userCommand); 这样做相当于“我”就是默认用户。也能实现那个效果。

@Esonfu Esonfu closed this as completed Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants