//
// This program is open source software. Use, duplication, and/or
// disclosure are subject to the GNU General Purpose License version 3.
//
// This program is open source software. Use, duplication, and/or
// disclosure are subject to the GNU General Purpose License version 3.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-/*
- * Check the password file for a host/port match; if found, stuff the user
- * name and password into the user/pass buffers
- */
+// Check the password file for a host/port match; if found, stuff the user
+// name and password into the user/pass buffers
void get_stored_password(char *host, char *port, char *username, char *password) {
char pwfile[PATH_MAX];
void get_stored_password(char *host, char *port, char *username, char *password) {
char pwfile[PATH_MAX];
while (fgets(buf64, sizeof buf64, fp) != NULL) {
CtdlDecodeBase64(buf, buf64, sizeof(buf64));
extract_token(hostbuf, buf, 0, '|', sizeof hostbuf);
while (fgets(buf64, sizeof buf64, fp) != NULL) {
CtdlDecodeBase64(buf, buf64, sizeof(buf64));
extract_token(hostbuf, buf, 0, '|', sizeof hostbuf);
void set_stored_password(char *host, char *port, char *username, char *password) {
char pwfile[PATH_MAX];
void set_stored_password(char *host, char *port, char *username, char *password) {
char pwfile[PATH_MAX];
while (fgets(buf64, sizeof buf64, oldfp) != NULL) {
CtdlDecodeBase64(buf, buf64, sizeof(buf64));
extract_token(hostbuf, buf, 0, '|', sizeof hostbuf);
while (fgets(buf64, sizeof buf64, oldfp) != NULL) {
CtdlDecodeBase64(buf, buf64, sizeof(buf64));
extract_token(hostbuf, buf, 0, '|', sizeof hostbuf);
extract_token(ubuf, buf, 2, '|', sizeof ubuf);
extract_token(pbuf, buf, 3, '|', sizeof pbuf);
extract_token(ubuf, buf, 2, '|', sizeof ubuf);
extract_token(pbuf, buf, 3, '|', sizeof pbuf);
- if ((strcasecmp(hostbuf, host))
- || (strcasecmp(portbuf, port))) {
+ if ((strcasecmp(hostbuf, host)) || (strcasecmp(portbuf, port))) {
snprintf(buf, sizeof buf, "%s|%s|%s|%s|", hostbuf, portbuf, ubuf, pbuf);
CtdlEncodeBase64(buf64, buf, strlen(buf), BASE64_NO_LINEBREAKS);
fprintf(fp, "%s\n", buf64);
snprintf(buf, sizeof buf, "%s|%s|%s|%s|", hostbuf, portbuf, ubuf, pbuf);
CtdlEncodeBase64(buf64, buf, strlen(buf), BASE64_NO_LINEBREAKS);
fprintf(fp, "%s\n", buf64);
void offer_to_remember_password(CtdlIPC * ipc, char *host, char *port, char *username, char *password) {
if (rc_remember_passwords) {
void offer_to_remember_password(CtdlIPC * ipc, char *host, char *port, char *username, char *password) {
if (rc_remember_passwords) {