Skip to content

Commit

Permalink
Version 1.29 released on 2005-04-28 14:09
Browse files Browse the repository at this point in the history
  • Loading branch information
dagwieers committed Jun 5, 2012
1 parent f60da27 commit deb00b2
Show file tree
Hide file tree
Showing 10 changed files with 371 additions and 169 deletions.
17 changes: 10 additions & 7 deletions .todo
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<!-- Automagically generated by the ToDo program on 07/04/05, 12:33 -->
<!-- Automagically generated by the ToDo program on 14/04/05, 23:43 -->
<todo version="0.1.18">
<note priority="veryhigh" time="1031936628" done="1049945547">
Fix limitation on parentheses recursion - use system regex library instead of bundled one?
<comment>
Increased recursion limit and increased maximum buffer length to 4K
</comment>
</note>
<note priority="medium" time="1031933086" done="1049945562">
Add note about regular expression searching (^athomas$)
<comment>
Forced regular expressions to have ^ prepended and $ appended. Safer.
</comment>
</note>
<note priority="veryhigh" time="1031936628" done="1049945547">
Fix limitation on parentheses recursion - use system regex library instead of bundled one?
<comment>
Increased recursion limit and increased maximum buffer length to 4K
</comment>
</note>
<note priority="medium" time="1050479786" done="1050562957">
Add minimal 'ifdef' facility, ie. have the same command do different things on different hosts and/or for different users/groups, etc.
<comment>
Expand All @@ -27,4 +27,7 @@
<note priority="medium" time="1108077380" done="1112841219">
Make a "nolog" option to prevent logging - for automated commands.
</note>
<note priority="medium" time="1113486219">
Fix bug where $VARS aren't being expanded correctly inside quotes. This is occurring in main.c.
</note>
</todo>
33 changes: 33 additions & 0 deletions .todo.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!-- Automagically generated by the ToDo program on 14/04/05, 23:43 -->
<todo version="0.1.18">
<note priority="medium" time="1031933086" done="1049945562">
Add note about regular expression searching (^athomas$)
<comment>
Forced regular expressions to have ^ prepended and $ appended. Safer.
</comment>
</note>
<note priority="veryhigh" time="1031936628" done="1049945547">
Fix limitation on parentheses recursion - use system regex library instead of bundled one?
<comment>
Increased recursion limit and increased maximum buffer length to 4K
</comment>
</note>
<note priority="medium" time="1050479786" done="1050562957">
Add minimal 'ifdef' facility, ie. have the same command do different things on different hosts and/or for different users/groups, etc.
<comment>
Not really necessary with the ability to execute arbitrary shell scripts.
</comment>
</note>
<note priority="medium" time="1050479815" done="1050484893">
Have facility to execute complex commands like '/bin/sh -c "if test $1 = on; then ....' etc.
<comment>
Accomplished this by allowing quoted strings
</comment>
</note>
<note priority="medium" time="1108077380" done="1112841219">
Make a "nolog" option to prevent logging - for automated commands.
</note>
<note priority="medium" time="1113486219">
Fix bug where $VARS aren't being expanded correctly inside quotes.
</note>
</todo>
30 changes: 30 additions & 0 deletions .todo.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!-- Automagically generated by the ToDo program on 07/04/05, 12:33 -->
<todo version="0.1.18">
<note priority="veryhigh" time="1031936628" done="1049945547">
Fix limitation on parentheses recursion - use system regex library instead of bundled one?
<comment>
Increased recursion limit and increased maximum buffer length to 4K
</comment>
</note>
<note priority="medium" time="1031933086" done="1049945562">
Add note about regular expression searching (^athomas$)
<comment>
Forced regular expressions to have ^ prepended and $ appended. Safer.
</comment>
</note>
<note priority="medium" time="1050479786" done="1050562957">
Add minimal 'ifdef' facility, ie. have the same command do different things on different hosts and/or for different users/groups, etc.
<comment>
Not really necessary with the ability to execute arbitrary shell scripts.
</comment>
</note>
<note priority="medium" time="1050479815" done="1050484893">
Have facility to execute complex commands like '/bin/sh -c "if test $1 = on; then ....' etc.
<comment>
Accomplished this by allowing quoted strings
</comment>
</note>
<note priority="medium" time="1108077380" done="1112841219">
Make a "nolog" option to prevent logging - for automated commands.
</note>
</todo>
14 changes: 13 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,23 @@ Hyland for this idea.
Also made error reporting a bit smarter when config files are missing or have
incorrect permissions.

07/04/05 - op 1.27
07/04/05 - op 1.27/1.28
==================
Added ''nolog'' option which suppresses informational logs. Useful for
automated jobs to prevent log spam.

Configuration files in /etc/op.d are now lexically sorted. This allows
variables in configuration files to be used deterministically. Commands
can also be overridden in this fashion.

08/04/05 - op 1.29
==================
Added -l argument which lists available commands.

Also added a {{{help="<help>"}}} option which defines the help string displayed
by -l.

Cleaned up the code a bit, adding some basic dynamic array functions instead of
replicating the code across multiple areas.

Closes #4
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ OPTS += -DHAVE_SNPRINTF
#
CFLAGS= $(OPTS) $(INC) $(GLOBALOPTS) $(SECURID)
REG = regexp.o
OBJ = lex.o main.o atov.o $(REG)
OBJ = lex.o util.o main.o atov.o $(REG)
op: $(OBJ) op.list
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(LDFLAGS) $(SECURIDLIBDIR) $(OBJ) $(SECURIDLIB) $(LIBS)
clean:
Expand Down
16 changes: 15 additions & 1 deletion defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@ typedef struct var_s {
struct var_s *next;
} var_t;

typedef struct array_s {
void **data;
int size, capacity;
} array_t;

/* functions to manage a dynamically extensible array of pointers */
#define ARRAY_CHUNK 32
array_t *array_alloc();
void array_free(array_t *array);
array_t *array_free_contents(array_t *array);
void *array_push(array_t *array, void *object);
void *array_pop(array_t *array);
int array_extend(array_t *array, int capacity);

extern cmd_t *First, *Build();
extern var_t *Variables;
extern unsigned minimum_logging_level;
Expand All @@ -39,7 +53,7 @@ int atov(char *str, int type);
#define MAXSTRLEN 2048
#define OP_ACCESS "/etc/op.conf"
#define OP_ACCESS_DIR "/etc/op.d"
#define VERSION "1.28"
#define VERSION "1.29"

#define VAR_EXPAND_LEN 8192
#define VAR_NAME_LEN 64
Expand Down
12 changes: 8 additions & 4 deletions lex.l
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ NWS [^ \n\t;]+
BEGIN ARGS; }
^{WS} BEGIN ARGS;
<ARGS>";" state++;
<ARGS>'(\\.|[^'])*' addquotedarg(state, cmd, yytext);
<ARGS>\"(\\.|[^\"])*\" addquotedarg(state, cmd, yytext);
<ARGS>([^ \n\t'"]*'(\\.|[^'])*')+ addquotedarg(state, cmd, yytext);
<ARGS>([^ \n\t'"]*\"(\\.|[^\"])*\")+ addquotedarg(state, cmd, yytext);
<ARGS>{NWS} addarg(state, cmd, yytext);
<ARGS>{WS} ;
%%
Expand Down Expand Up @@ -175,13 +175,17 @@ const char *eq = strchr(str, '=');

static void addquotedarg(int state, cmd_t *cmd, const char *instr) {
char buffer[MAXSTRLEN];
int i, o;
int i, o, q;

if (strlen(instr) + 2 > MAXSTRLEN) {
fatal(1, "Quoted argument too long\n");
exit(1);
}
for (o = 0, i = 1; instr[i] != instr[0]; ++i, ++o) {
for (o = 0; !strchr("'\"", instr[o]); ++o)
buffer[o] = instr[o];
q = o;

for (i = o + 1; instr[i] && instr[i] != instr[q]; ++i, ++o) {
if (instr[i] == '\\') {
int c = instr[++i];

Expand Down
Loading

0 comments on commit deb00b2

Please sign in to comment.