Merged ritt/elog into master

This commit is contained in:
Jason Gochanour
2016-05-26 11:34:48 -06:00
9 changed files with 127 additions and 78 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
+3 -3
View File
@@ -116,8 +116,8 @@ endif
all: $(EXECS)
# put current GIT revision into header file to be included by programs
$(GIT_REVISION): src/elogd.c
echo \#define GIT_REVISION \"`git log -n 1 --pretty=format:"%ad - %h"`\" > $(GIT_REVISION)
$(GIT_REVISION): src/elogd.c src/elog.c
type git &> /dev/null; if [ $$? -eq 1 ]; then REV="unknown" ;else REV=`git log -n 1 --pretty=format:"%ad - %h"`; fi; echo \#define GIT_REVISION \"$$REV\" > $(GIT_REVISION)
regex.o: src/regex.c src/regex.h
$(CC) $(CFLAGS) -w -c -o regex.o src/regex.c
@@ -137,7 +137,7 @@ strlcpy.o: src/strlcpy.c src/strlcpy.h
elogd: src/elogd.c regex.o crypt.o auth.o mxml.o $(GIT_REVISION)
$(CC) $(CFLAGS) -o elogd src/elogd.c crypt.o auth.o regex.o mxml.o $(OBJS) $(LIBS)
elog: src/elog.c crypt.o $(OBJS)
elog: src/elog.c crypt.o $(OBJS) $(GIT_REVISION)
$(CC) $(CFLAGS) -o elog src/elog.c crypt.o $(OBJS) $(LIBS)
debug: src/elogd.c regex.o crypt.o auth.o mxml.o
Executable → Regular
+34 -39
View File
@@ -1,9 +1,8 @@
#
# French translation by Fred Pacquier <fredp@dial.oleane.com>
# (for 2.9.1+)
# (for 3.1.1+)
# A more recent version may be available at :
# http://savannah.psi.ch/viewcvs/trunk/resources/eloglang.french?root=elog
#
# https://bitbucket.org/ritt/elog/src/b4d2a375a1c1991daa94427455f57665f7497df0/resources/eloglang.french?at=master&fileviewer=file-view-default
New = Créer
Edit = Modifier
@@ -324,19 +323,19 @@ Preview = Pr
FONT = POLICE
SIZE = TAILLE
COLOR = COULEUR
astonished =
smiling =
happy =
winking =
big grin =
crying =
cool =
frowning =
confused =
mad =
pleased =
tongue =
yawn =
astonished = surpris
smiling = souriant
happy = heureux
winking = clin d'oeuil
big grin = grand sourire
crying = plure
cool = tranquille
frowning = fronce les sourcils
confused = perdu
mad = furieux
pleased = content
tongue = tire la langue
yawn = baille
Encoding = Encodage
User "%s" not found in password file = Utilisateur "%s" non trouvé dans le fichier des comptes
Cannot write to file <b>%s</b> = Impossible d'écrire dans le fichier <b>%s</b>
@@ -467,26 +466,22 @@ This is an automatically generated account recovery email for host %s = Ceci est
Please click on following link to recover your account = Veuillez cliquer sur le lien suivant pour récupérer votre compte
Email address "%s" not registered = L'adresse mail "%s" n'est pas enregistrée
User name "%s" not registered = Le nom d'utilisateur "%s" n'est pas enregistré
#
#---- please translate following items and then remove this comment ----#
#
Error accessing password file =
CSV (";" separated) + Text =
Entry can only be deleted %1.2lg hours after creation =
Drop attachments here... =
Insert Timestamp =
Pending draft available =
%d pending drafts available =
Create new entry =
If you leave this page you will lose your unsaved changes =
Edited =
All time =
Draft =
Restrict seach to last =
days =
Draft saved at =
You might however then overwrite each other's modifications =
Draft entry created on %s by %s =
Really delete this entry? =
This is a draft message, edit and submit it to make it permanent =
Error accessing password file = Problème d'accès au fichier des mots de passe
CSV (";" separated) + Text = CSV (séparateur ";") + Texte
Entry can only be deleted %1.2lg hours after creation = Une entrée ne peut être supprimée que %1.2lg heures après sa création
Drop attachments here... = Glisser les attachements ici...
Insert Timestamp = Insérer horodatage
Pending draft available = Brouillon en attente disponible
%d pending drafts available = %d brouillons en attente disponibles
Create new entry = Créer une nouvelle entrée
If you leave this page you will lose your unsaved changes = Si vous quittez cette page vos modifications non enregistrées seront perdues
Edited = Modifié
All time = Tous temps
Draft = Brouillon
Restrict seach to last = Restreindre la recherche aux
days = derniers jours
Draft saved at = Brouillon enregistré le
You might however then overwrite each other's modifications = Vous pourriez toutefois écraser mutuellement vos modifications
Draft entry created on %s by %s = Brouillon créé le %s par %s
Really delete this entry? = Supprimer cette entrée, vraiment ?
This is a draft message, edit and submit it to make it permanent = Ceci est un brouillon, modifiez-le et validez-le pour le rendre définitif
+1 -1
View File
@@ -1,4 +1,4 @@
/**
/**
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.html or http://ckeditor.com/license
*/
+7
View File
@@ -470,6 +470,13 @@ int auth_verify_password(LOGBOOK * lbs, const char *user, const char *password,
error_str[0] = 0;
verified = FALSE;
/* otherwise calls with null lbs which make this procedure crash */
if (lbs == NULL)
lbs = get_first_lbs_with_global_passwd();
if (lbs == NULL)
return FALSE;
getcfg(lbs->name, "Authentication", str, sizeof(str));
#ifdef HAVE_KRB5
+15 -7
View File
@@ -20,12 +20,12 @@
Contents: Electronic logbook utility
$Id$
\********************************************************************/
#include "elog-version.h"
char svn_revision[] = "$Id$";
#include "git-revision.h"
const char *_git_revision = GIT_REVISION;
#include <stdio.h>
#include <sys/types.h>
@@ -73,6 +73,17 @@ char text[TEXT_SIZE], old_text[TEXT_SIZE], new_text[TEXT_SIZE];
/*------------------------------------------------------------------*/
const char *git_revision()
{
const char *p = _git_revision;
if (strrchr(p, '-'))
p = strrchr(p, '-')+2;
return p;
}
/*------------------------------------------------------------------*/
char *map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
void base64_encode(unsigned char *s, unsigned char *d, int size)
@@ -1051,10 +1062,7 @@ int main(int argc, char *argv[])
} else {
usage:
printf("%s ", ELOGID);
strcpy(str, svn_revision + 13);
if (strchr(str, ' '))
*strchr(str, ' ') = 0;
printf("revision %s\n", str);
printf("revision %s\n", git_revision());
printf("\nusage: elog\n");
printf("elog -h <hostname> [-p port] [-d subdir]\n");
printf(" Location where elogd is running\n");
+63 -22
View File
@@ -1718,12 +1718,14 @@ int setegroup(char *str)
gr = getgrnam(str);
if (gr != NULL)
if (gr != NULL) {
chown(logbook_dir, -1, gr->gr_gid);
if (setregid(-1, gr->gr_gid) >= 0 && initgroups(gr->gr_name, gr->gr_gid) >= 0)
return 0;
else {
eprintf("Cannot set effective GID to group \"%s\"\n", gr->gr_name);
eprintf("setgroup: %s\n", strerror(errno));
}
} else
eprintf("Group \"%s\" not found\n", str);
@@ -1741,12 +1743,14 @@ int seteuser(char *str)
pw = getpwnam(str);
if (pw != NULL)
if (pw != NULL) {
chown(logbook_dir, pw->pw_uid, -1);
if (setreuid(-1, pw->pw_uid) >= 0) {
return 0;
} else {
eprintf("Cannot set effective UID to user \"%s\"\n", str);
eprintf("setuser: %s\n", strerror(errno));
}
} else
eprintf("User \"%s\" not found\n", str);
@@ -8902,7 +8906,12 @@ void show_change_pwd_page(LOGBOOK * lbs)
{
char str[256], config[256], old_pwd[256], new_pwd[256], new_pwd2[256], user[256], auth[32], error_str[256];
int wrong_pwd;
/* otherwise calls with null lbs which make this procedure crash */
if (lbs == NULL)
lbs = get_first_lbs_with_global_passwd();
if (lbs == NULL)
return;
getcfg(lbs->name, "Authentication", auth, sizeof(auth));
old_pwd[0] = new_pwd[0] = new_pwd2[0] = 0;
@@ -10490,7 +10499,8 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
/*---- add password in case cookie expires during edit ----*/
if (getcfg(lbs->name, "Password file", str, sizeof(str)) && isparam("unm")) {
rsprintf("<input type=hidden name=\"unm\" value=\"%s\">\n", getparam("unm"));
strencode2(str, getparam("unm"), sizeof(str));
rsprintf("<input type=hidden name=\"unm\" value=\"%s\">\n", str);
if (isparam("upwd"))
strlcpy(upwd, getparam("upwd"), sizeof(upwd));
else
@@ -10577,7 +10587,9 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
rsprintf("<tr><td nowrap width=\"10%%\" class=\"attribname\">%s:</td>", loc("Entry time"));
rsprintf("<td class=\"attribvalue\">%s\n", str);
rsprintf("<input type=hidden name=entry_date value=\"%s\"></td></tr>\n", date);
strencode2(str, date, sizeof(str));
rsprintf("<input type=hidden name=entry_date value=\"%s\"></td></tr>\n", str);
}
if (_condition[0])
@@ -11839,7 +11851,8 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
thumb_ref[0] = 0;
if (strlen(att[index]) < 14 || att[index][6] != '_' || att[index][13] != '_') {
rsprintf("<b>Error: Invalid attachment \"%s\"</b><br>", att);
strencode2(str, att[index], sizeof(str));
rsprintf("<b>Error: Invalid attachment \"%s\"</b><br>", str);
} else {
strlcpy(file_name, lbs->data_dir, sizeof(file_name));
@@ -11889,7 +11902,8 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
rsprintf("&nbsp;&nbsp;\n");
/* ImageMagick available, so get image size */
rsprintf("<b>%s</b>&nbsp;\n", att[index] + 14);
strencode2(str, att[index], sizeof(str));
rsprintf("<b>%s</b>&nbsp;\n", str + 14);
if (chkext(file_name, ".pdf") || chkext(file_name, ".ps"))
sprintf(cmd, "%s -format '%%wx%%h' '%s[0]'", _identify_cmd, file_name);
else
@@ -12006,10 +12020,11 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
rsprintf("</td></tr></table>\n");
}
strencode2(str, att[index], sizeof(str));
if (thumb_ref[0])
rsprintf("<input type=hidden name=\"attachment%d\" alt=\"%s\" value=\"%s\">\n", index, thumb_ref, att[index]);
rsprintf("<input type=hidden name=\"attachment%d\" alt=\"%s\" value=\"%s\">\n", index, thumb_ref, str);
else
rsprintf("<input type=hidden name=\"attachment%d\" value=\"%s\">\n", index, att[index]);
rsprintf("<input type=hidden name=\"attachment%d\" value=\"%s\">\n", index, str);
rsprintf("</td></tr>\n");
} else
@@ -13739,7 +13754,8 @@ void show_config_page(LOGBOOK * lbs)
rsprintf("<!--\n\n");
rsprintf("function chkrem()\n");
rsprintf("{\n");
sprintf(str, loc("Really remove user %s?"), user);
strencode2(str, user, sizeof(str));
sprintf(str, loc("Really remove user %s?"), str);
rsprintf(" var subm = confirm(\"%s\");\n", str);
rsprintf(" return subm;\n");
rsprintf("}\n\n");
@@ -13772,7 +13788,8 @@ void show_config_page(LOGBOOK * lbs)
rsprintf("<input type=hidden name=cmd value=\"%s\">\n", loc("Config")); // for select javascript
rsprintf("<input type=submit name=cmd value=\"%s\">\n", loc("Save"));
rsprintf("<input type=submit name=cmd value=\"%s\">\n", loc("Back"));
rsprintf("<input type=hidden name=config value=\"%s\">\n", user);
strencode2(str, user, sizeof(str));
rsprintf("<input type=hidden name=config value=\"%s\">\n", str);
rsprintf("<input type=hidden name=cfgpage value=\"1\">\n"); // needed for "Save" command
rsprintf("</span></td></tr>\n\n");
@@ -13807,10 +13824,14 @@ void show_config_page(LOGBOOK * lbs)
for (i = 0; i < n; i++) {
get_user_line(lbs, user_list[i], NULL, full_name, user_email, NULL, NULL, NULL);
if (strcmp(user_list[i], user) == 0)
rsprintf("<option selected value=\"%s\">%s &lt;%s&gt;\n", user_list[i], user_list[i], user_email);
else
rsprintf("<option value=\"%s\">%s &lt;%s&gt;\n", user_list[i], user_list[i], user_email);
if (strcmp(user_list[i], user) == 0) {
strencode2(str, user_list[i], sizeof(str));
rsprintf("<option selected value=\"%s\">%s &lt;%s&gt;\n", str, str, user_email);
}
else {
strencode2(str, user_list[i], sizeof(str));
rsprintf("<option selected value=\"%s\">%s &lt;%s&gt;\n", str, str, user_email);
}
}
for (i = 0; i < n; i++)
@@ -13849,6 +13870,8 @@ void show_config_page(LOGBOOK * lbs)
rsprintf("<tr><td nowrap width=\"15%%\">%s:</td>\n", loc("Login name"));
getcfg(lbs->name, "Authentication", auth, sizeof(auth));
strencode2(str, user, sizeof(str));
if (stristr(auth, "Kerberos") || stristr(auth, "Webserver"))
rsprintf("<td><input type=text size=40 name=new_user_name value=\"%s\" readonly></td></tr>\n", str);
else
@@ -14114,7 +14137,9 @@ void show_forgot_pwd_page(LOGBOOK * lbs)
url_slash_encode(pwd, sizeof(pwd));
sprintf(redir, "?cmd=%s&oldpwd=%s", loc("Change password"), pwd);
url_encode(redir, sizeof(redir));
sprintf(str, "?redir=%s&uname=%s&upassword=%s", redir, login_name, pwd);
strencode2(str2, redir, sizeof(str2));
sprintf(str, "?redir=%s&uname=%s&upassword=%s", str2, login_name, pwd);
strlcat(url, str, sizeof(url));
retrieve_email_from(lbs, mail_from, mail_from_name, NULL);
@@ -14235,7 +14260,8 @@ void show_new_user_page(LOGBOOK * lbs, char *user)
rsprintf("<tr><td nowrap>%s:</td>\n", loc("Login name"));
if (user && user[0]) {
rsprintf("<td><input type=text size=40 name=new_user_name value=\"%s\" readonly></td>\n", user);
strencode2(str, user, sizeof(str));
rsprintf("<td><input type=text size=40 name=new_user_name value=\"%s\" readonly></td>\n", str);
rsprintf("<td>&nbsp;</td>\n");
} else {
rsprintf("<td><input type=text size=40 name=new_user_name></td>\n");
@@ -22563,7 +22589,7 @@ int execute_shell(LOGBOOK * lbs, int message_id, char attrib[MAX_N_ATTR][NAME_LE
p = stristr(shell_cmd, "$attachments");
strlcpy(tail, p + strlen("$attachments"), sizeof(tail));
*p = 0;
for (i = 0; i < MAX_ATTACHMENTS; i++)
for (i = 0; i < MAX_ATTACHMENTS; i++) {
generate_subdir_name(att_file[i], subdir, sizeof(subdir));
if (att_file[i][0] && strlen(shell_cmd) + strlen(lbs->data_dir) + strlen(subdir) + strlen(att_file[i])
< sizeof(shell_cmd) + 1) {
@@ -22576,6 +22602,7 @@ int execute_shell(LOGBOOK * lbs, int message_id, char attrib[MAX_N_ATTR][NAME_LE
strcat(p, "\" ");
p += strlen(p);
}
}
strlcat(shell_cmd, tail, sizeof(shell_cmd));
}
@@ -24143,7 +24170,7 @@ int get_thumb_name(const char *file_name, char *thumb_name, int size, int index)
void call_image_magick(LOGBOOK * lbs)
{
char str[256], cmd[256], file_name[256], thumb_name[256], subdir[256];
char str[1024], cmd[1024], file_name[256], thumb_name[256], subdir[256];
int cur_width, cur_height, new_size, cur_rot, new_rot, thumb_status;
if (!isparam("req") || !isparam("img")) {
@@ -26109,6 +26136,9 @@ void show_login_page(LOGBOOK * lbs, char *redir, int fail)
strlcpy(str, redir, sizeof(str));
if (strchr(str, '<'))
url_encode(str, sizeof(str));
if (strchr(str, ' '))
return;
rsprintf("<input type=hidden name=redir value=\"%s\">\n", str);
rsprintf("<table class=\"login_frame\" cellspacing=0 align=center>");
@@ -26124,12 +26154,15 @@ void show_login_page(LOGBOOK * lbs, char *redir, int fail)
sprintf(str, loc("User \"%s\" has no access to this logbook"), getparam("unm"));
rsprintf("<tr><td class=\"dlgerror\">%s!</td></tr>\n", str);
}
if (isparam("unm"))
strencode2(str, getparam("unm"), sizeof(str));
rsprintf("<tr><td class=\"login_form\">\n");
rsprintf("<span class=\"overlay_wrapper\">\n");
rsprintf("<label for=\"uname\" id=\"uname\" class=\"overlabel\">%s</label>\n", loc("Username"));
rsprintf("<input type=\"text\" class=\"login_input\" name=\"uname\" value=\"%s\" title=\"%s\" onInput=\"document.getElementById('uname').style.display='none';\">\n",
isparam("unm") ? getparam("unm") : "", loc("Username"));
isparam("unm") ? str : "", loc("Username"));
rsprintf("</span></td></tr>\n");
rsprintf("<tr><td class=\"login_form\">\n");
@@ -27373,7 +27406,7 @@ void interprete(char *lbook, char *path)
/* check if user has access to logbook */
if (!check_login_user(lbs, getparam("uname"))) {
show_error("Use has no access to this logbook");
show_error("User has no access to this logbook");
return;
}
@@ -29688,13 +29721,21 @@ void server_loop(void)
#ifndef HAVE_KRB5
/* check for Kerberos authentication */
getcfg("gloabl", "Authentication", str, sizeof(str));
getcfg("global", "Authentication", str, sizeof(str));
if (stristr(str, "Kerberos")) {
eprintf("Kerberos authentication not compiled into this version of elogd.\n");
exit(EXIT_FAILURE);
}
#endif
#ifndef HAVE_LDAP
/* check for Kerberos authentication */
/* NPA change */
getcfg("global", "Authentication", str, sizeof(str));
if (stristr(str, "LDAP")) {
eprintf("LDAP authentication not compiled into this version of elogd.\n");
exit(EXIT_FAILURE);
}
#endif
/* listen for connection */
status = listen(lsock, SOMAXCONN);
if (status < 0) {
+1 -4
View File
@@ -187,10 +187,7 @@
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
HAVE_SSL,
DEBUG,
);
GCC_PREPROCESSOR_DEFINITIONS = DEBUG;
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
OTHER_LDFLAGS = "-lssl";
PRODUCT_NAME = "$(TARGET_NAME)";
+2 -1
View File
@@ -153,7 +153,7 @@
D52BA2F113999DB0000458E3 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0630;
LastUpgradeCheck = 0720;
ORGANIZATIONNAME = PSI;
};
buildConfigurationList = D52BA2F413999DB0000458E3 /* Build configuration list for PBXProject "elogd" */;
@@ -218,6 +218,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;