Skip to content

Commit 1e70dd7

Browse files
author
Arvo Järve
committed
Merge branch 'master' of https://github.com/Hamlib/Hamlib
2 parents 571e990 + c5a5276 commit 1e70dd7

File tree

7 files changed

+70
-16
lines changed

7 files changed

+70
-16
lines changed

security/Makefile.am

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11
EXTRA_DIST = sctest.c
2-
security_test_SOURCES = security_test.c aes.h AESStringCrypt.h password.h security.h sha256.h
32

4-
#security_test_LIBS = libsecurity.la
5-
#security_test_LDFLAGS = -L.
6-
#security_test_CFLAGS = -L. -I.
7-
8-
#bin_PROGRAMS = security_test
93
noinst_LTLIBRARIES = libsecurity.la
10-
#noinst_PROGRAMS = security_test
114

12-
libsecurity_la_SOURCES = aes.c AESStringCrypt.c password.c security.c sha256.c
13-
libsecurity_la_CFLAGS = -I.
5+
libsecurity_la_SOURCES = aes.c AESStringCrypt.c password.c security.c sha256.c aes.h AESStringCrypt.h password.h security.h sha256.h
6+
libsecurity_la_CFLAGS = -I$(srcdir)
147
LDADD = $(top_builddir)/src/libhamlib.la $(top_builddir)/security/libsecurity.la
15-
#security_test_LDADD = $(LDADD)
16-
17-
#check_PROGRAMS = security_test

src/rig.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7097,6 +7097,7 @@ void *async_data_handler(void *arg)
70977097

70987098
return NULL;
70997099
}
7100+
#endif
71007101

71017102
HAMLIB_EXPORT(int) rig_password(RIG *rig, const unsigned char *key1, const unsigned char *key2)
71027103
{
@@ -7109,4 +7110,3 @@ HAMLIB_EXPORT(int) rig_password(RIG *rig, const unsigned char *key1, const unsig
71097110
RETURNFUNC(retval);
71107111
}
71117112

7112-
#endif

tests/Makefile.am

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ DISTCLEANFILES = rigctl.log rigctl.sum testbcd.log testbcd.sum
1616

1717
bin_PROGRAMS = rigctl rigctld rigmem rigsmtr rigswr rotctl rotctld rigctlcom ampctl ampctld $(TESTLIBUSB)
1818

19+
#check_PROGRAMS = dumpmem testrig testrigopen testrigcaps testtrn testbcd testfreq listrigs testloc rig_bench testcache cachetest cachetest2 testcookie testgrid testsecurity
1920
check_PROGRAMS = dumpmem testrig testrigopen testrigcaps testtrn testbcd testfreq listrigs testloc rig_bench testcache cachetest cachetest2 testcookie testgrid
2021

2122
RIGCOMMONSRC = rigctl_parse.c rigctl_parse.h dumpcaps.c uthash.h
@@ -37,7 +38,7 @@ if HAVE_LIBUSB
3738
endif
3839

3940
# include generated include files ahead of any in sources
40-
rigctl_CPPFLAGS = -I$(top_builddir)/tests -I$(top_builddir)/src -I$(srcdir) $(AM_CPPFLAGS)
41+
rigctl_CPPFLAGS = -I$(top_builddir)/tests -I$(top_builddir)/src -I$(srcdir) -I$(top_srcdir)/security $(AM_CPPFLAGS)
4142

4243
# all the programs need this
4344
LDADD = $(top_builddir)/src/libhamlib.la $(top_builddir)/lib/libmisc.la $(DL_LIBS)
@@ -52,6 +53,7 @@ rigctlcom_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS)
5253
if HAVE_LIBUSB
5354
rigtestlibusb_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(LIBUSB_CFLAGS)
5455
endif
56+
#testsecurity_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I$(top_builddir)/src -I$(top_builddir)/security
5557

5658
rigctl_LDADD = $(PTHREAD_LIBS) $(READLINE_LIBS) $(LDADD)
5759
rigctld_LDADD = $(NET_LIBS) $(PTHREAD_LIBS) $(LDADD) $(READLINE_LIBS)

tests/func_chk.c

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/* this can change for balanced ENTERFUNC/RETURNFUNC statements */
2+
/* RETURNFUNC2 is used when ENTERFUNC is not used in a function */
3+
#include <stdio.h>
4+
#include <string.h>
5+
6+
int main(int argc, char *argv[])
7+
{
8+
char buf[4096];
9+
char buf2[4096];
10+
FILE *fp = fopen(argv[1], "r");
11+
int linenum = 0;
12+
int enterfunc = 0;
13+
int infunc = 0;
14+
int retval = 0;
15+
retval = 0;
16+
17+
while (fgets(buf, sizeof(buf), fp))
18+
{
19+
++linenum;
20+
buf[16] = 0;
21+
22+
if (strstr(buf, "ENTERFUNC;")) { enterfunc = 1; }
23+
24+
if (enterfunc && strstr(buf, "RETURNFUNC2"))
25+
{
26+
printf("Line#%d need RETURNFUNC %s\n", linenum, argv[1]);
27+
retval = 1;
28+
}
29+
30+
strcpy(buf2, buf);
31+
buf2[15] = 0; // truncate the string
32+
33+
if (!enterfunc && strstr(buf2, "RETURNFUNC("))
34+
{
35+
printf("Line#%d need RETURNFUNC2 %s\n", linenum, argv[1]);
36+
retval = 1;
37+
}
38+
39+
if (strstr(buf2, "RETURNFUNC("))
40+
{
41+
if (enterfunc == 0) { printf("Line#%d no matching ENTERFUNC %s\n", linenum, argv[1]); }
42+
43+
enterfunc = 0;
44+
}
45+
}
46+
47+
fclose(fp);
48+
return retval;
49+
}

tests/rigctl_parse.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,9 +1690,15 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc,
16901690

16911691
// chk_vfo is the one command we'll allow without a password
16921692
// since it's in the initial handshake
1693-
if (use_password && !is_passwordOK && (cmd_entry->arg1 != NULL) && strcmp(cmd_entry->arg1,"ChkVFO")!=0)
1693+
int preCmd = 0; // some command are allowed without passoword to satisfy rigctld initialization from rigctl -m 2
1694+
if (cmd_entry->arg1 != NULL)
16941695
{
1695-
rig_debug(RIG_DEBUG_ERR, "%s: need password=%s\n", __func__, rigctld_password);
1696+
if (strcmp(cmd_entry->arg1,"ChkVFO")==0) preCmd = 1;
1697+
else if (strcmp(cmd_entry->arg1,"VFO")==0) preCmd = 1;
1698+
}
1699+
if (use_password && !is_passwordOK && (cmd_entry->arg1 != NULL) && !preCmd)
1700+
{
1701+
rig_debug(RIG_DEBUG_ERR, "%s: need password=%s for cmd=%s\n", __func__, rigctld_password, cmd_entry->arg1);
16961702
return(-RIG_EPROTO);
16971703
}
16981704
retcode = (*cmd_entry->rig_routine)(my_rig,

tests/rigctld.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,11 @@ int main(int argc, char *argv[])
979979
rig_debug(RIG_DEBUG_ERR, "%s: select() failed: %s\n", __func__,
980980
strerror(errno_stored));
981981

982+
if (ctrl_c)
983+
{
984+
rig_debug(RIG_DEBUG_VERBOSE, "%s: ctrl_c when retcode==-1\n", __func__);
985+
break;
986+
}
982987
if (errno == EINTR)
983988
{
984989
rig_debug(RIG_DEBUG_VERBOSE, "%s: ignoring interrupted system call\n",
@@ -990,6 +995,7 @@ int main(int argc, char *argv[])
990995
{
991996
if (ctrl_c)
992997
{
998+
rig_debug(RIG_DEBUG_VERBOSE, "%s: ctrl_c when retcode==0\n", __func__);
993999
break;
9941000
}
9951001
}
@@ -1045,6 +1051,7 @@ int main(int argc, char *argv[])
10451051
}
10461052
}
10471053
while (retcode == 0 && !ctrl_c);
1054+
rig_debug(RIG_DEBUG_VERBOSE, "%s: while loop done\n", __func__);
10481055

10491056
#ifdef HAVE_PTHREAD
10501057
/* allow threads to finish current action */
File renamed without changes.

0 commit comments

Comments
 (0)