]> code.citadel.org Git - citadel.git/blobdiff - textclient/client_passwords.c
textclient: bootstrap is no longer needed and is now just a stub to keep old scripts...
[citadel.git] / textclient / client_passwords.c
index 522ec882564c674f0de8f0b18bbd74eac4e3b0d6..59c9c04238912703a7863d0f6b30265666b7a558 100644 (file)
@@ -1,24 +1,21 @@
-/*
- * Functions which allow the client to remember usernames and passwords for
- * various sites.
- *
- * Copyright (c) 1987-2016 by the citadel.org team
- *
- *  This program is open source software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public 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.
- */
+// Functions which allow the client to remember usernames and passwords for
+// various sites.
+//
+// Copyright (c) 1987-2016 by the citadel.org team
+//
+// 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.
 
 #include "textclient.h"
 
 #define PWFILENAME "%s/.citadel.passwords"
 
-void determine_pwfilename(char *pwfile, size_t n)
-{
+void determine_pwfilename(char *pwfile, size_t n) {
        struct passwd *p;
 
        p = getpwuid(getuid());
@@ -32,8 +29,7 @@ void determine_pwfilename(char *pwfile, size_t n)
  * 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)
-{
+void get_stored_password(char *host, char *port, char *username, char *password) {
 
        char pwfile[PATH_MAX];
        FILE *fp;
@@ -72,8 +68,7 @@ void get_stored_password(char *host, char *port, char *username, char *password)
 /*
  * Set (or clear) stored passwords.
  */
-void set_stored_password(char *host, char *port, char *username, char *password)
-{
+void set_stored_password(char *host, char *port, char *username, char *password) {
 
        char pwfile[PATH_MAX];
        FILE *fp, *oldfp;
@@ -102,13 +97,13 @@ void set_stored_password(char *host, char *port, char *username, char *password)
                if ((strcasecmp(hostbuf, host))
                    || (strcasecmp(portbuf, port))) {
                        snprintf(buf, sizeof buf, "%s|%s|%s|%s|", hostbuf, portbuf, ubuf, pbuf);
-                       CtdlEncodeBase64(buf64, buf, strlen(buf), 0);
+                       CtdlEncodeBase64(buf64, buf, strlen(buf), BASE64_NO_LINEBREAKS);
                        fprintf(fp, "%s\n", buf64);
                }
        }
        if (!IsEmptyStr(username)) {
                snprintf(buf, sizeof buf, "%s|%s|%s|%s|", host, port, username, password);
-               CtdlEncodeBase64(buf64, buf, strlen(buf), 0);
+               CtdlEncodeBase64(buf64, buf, strlen(buf), BASE64_NO_LINEBREAKS);
                fprintf(fp, "%s\n", buf64);
        }
        fclose(oldfp);
@@ -120,13 +115,13 @@ void set_stored_password(char *host, char *port, char *username, char *password)
 /*
  * Set the password if the user wants to, clear it otherwise 
  */
-void offer_to_remember_password(CtdlIPC * ipc, char *host, char *port, char *username, char *password)
-{
+void offer_to_remember_password(CtdlIPC * ipc, char *host, char *port, char *username, char *password) {
 
        if (rc_remember_passwords) {
                if (boolprompt("Remember username/password for this site", 0)) {
                        set_stored_password(host, port, username, password);
-               } else {
+               }
+               else {
                        set_stored_password(host, port, "", "");
                }
        }