Skip to content

Commit

Permalink
Add OSHW certification mark and telnet responsiveness fix. (#73)
Browse files Browse the repository at this point in the history
* Cleanup telnet implementation.
* Added OSHW certification mark
  • Loading branch information
tjko committed Feb 5, 2024
1 parent 853e7ba commit 73099df
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 14 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ target_sources(libb64 INTERFACE
# pico-telnetd
add_subdirectory(libs/pico-telnetd)


# fanpico firmware

add_executable(fanpico
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<a href="https://certification.oshwa.org/us002599.html" title="Open Source Hardware Association Certificate"><img align="right" width="20%" src="images/fanpico-oshw.svg" alt="[OSHW] US002599 | Certified open source hardware | oshwa.org/cert"></a>

# Fanpico: Smart PWM (PC) Fan Controller
[![CI](https://github.com/tjko/fanpico/actions/workflows/cmake.yml/badge.svg)](https://github.com/tjko/fanpico/actions/workflows/cmake.yml)
[![CodeQL](https://github.com/tjko/fanpico/actions/workflows/codeql.yml/badge.svg)](https://github.com/tjko/fanpico/actions/workflows/codeql.yml)
Expand Down
33 changes: 33 additions & 0 deletions images/fanpico-oshw.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion libs/pico-telnetd
27 changes: 14 additions & 13 deletions src/telnetd.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,31 @@ static const char *telnet_banner = "\r\n"
" |_| \\__,_|_| |_|_| |_|\\___\\___/ \r\n"
" \r\n";

static user_pwhash_entry_t users[] = {
static user_pwhash_entry_t telnet_users[] = {
{ NULL, NULL },
{ NULL, NULL }
};

static tcp_server_t *telnet_srv = NULL;

void telnetserver_init()
{
tcp_server_t *srv = telnet_server_init(4096, 10240);

if (!srv)
telnet_srv = telnet_server_init(4096, 10240);
if (!telnet_srv)
return;

users[0].login = cfg->telnet_user;
users[0].hash = cfg->telnet_pwhash;
srv->mode = (cfg->telnet_raw_mode ? RAW_MODE : TELNET_MODE);
telnet_users[0].login = cfg->telnet_user;
telnet_users[0].hash = cfg->telnet_pwhash;
telnet_srv->mode = (cfg->telnet_raw_mode ? RAW_MODE : TELNET_MODE);
if (cfg->telnet_port > 0)
srv->port = cfg->telnet_port;
telnet_srv->port = cfg->telnet_port;
if (cfg->telnet_auth) {
srv->auth_cb = sha512crypt_auth_cb;
srv->auth_cb_param = (void*)users;
telnet_srv->auth_cb = sha512crypt_auth_cb;
telnet_srv->auth_cb_param = (void*)telnet_users;
}
srv->log_cb = log_msg;
srv->banner = telnet_banner;
telnet_srv->log_cb = log_msg;
telnet_srv->banner = telnet_banner;

telnet_server_start(srv, true);
telnet_server_start(telnet_srv, true);
}

0 comments on commit 73099df

Please sign in to comment.