aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid M. Syzdek <david@syzdek.net>2021-07-24 23:04:53 -0800
committerDavid M. Syzdek <david@syzdek.net>2021-07-24 23:04:53 -0800
commit60c12191611ca9bea08424774f08cfaa77fda6a1 (patch)
tree5959cc1d68191af76b302acd3814234f61f63685
parent3b958fe39f433c2b4dac9dcc1ff613c969ef8f8f (diff)
downloadsecurecoreutils-60c12191611ca9bea08424774f08cfaa77fda6a1.tar.gz
securecoreutils-60c12191611ca9bea08424774f08cfaa77fda6a1.tar.bz2
securecoreutils-60c12191611ca9bea08424774f08cfaa77fda6a1.tar.xz
securecoreutils-60c12191611ca9bea08424774f08cfaa77fda6a1.zip
core: updating widget lookup to match name exactly if using symlinked widget
-rw-r--r--ChangeLog1
-rw-r--r--src/securecoreutils.c46
2 files changed, 27 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index e13b7b8..64386a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@ Secure Core Utilities
3Copyright (C) 2015, 2017, 2018, 2019 David M. Syzdek <david@syzdek.net>. 3Copyright (C) 2015, 2017, 2018, 2019 David M. Syzdek <david@syzdek.net>.
4 4
50.3 50.3
6 - core: forcing symlink command to match widget name exactly (syzdek)
6 - core: fixing portability issues to musl libc (syzdek) 7 - core: fixing portability issues to musl libc (syzdek)
7 - core: updating autoconf checks (syzdek) 8 - core: updating autoconf checks (syzdek)
8 - core: accepting tabs, '\n', '\r', and form feed as ASCII (syzdek) 9 - core: accepting tabs, '\n', '\r', and form feed as ASCII (syzdek)
diff --git a/src/securecoreutils.c b/src/securecoreutils.c
index 27f379e..8daf031 100644
--- a/src/securecoreutils.c
+++ b/src/securecoreutils.c
@@ -524,18 +524,21 @@ const scu_widget * scu_widget_lookup(const char * wname, int exact)
524 // compares widget name 524 // compares widget name
525 if (strcmp(widget->name, wname) == 0) 525 if (strcmp(widget->name, wname) == 0)
526 return(widget); 526 return(widget);
527 for(z = 0; ( (widget->name[z] != '\0') && 527 if (!(exact))
528 (wname[z] != '\0') &&
529 (widget->name[z] == wname[z]) ); z++)
530 { 528 {
531 if (z > prefix_uniq) 529 for(z = 0; ( (widget->name[z] != '\0') &&
532 { 530 (wname[z] != '\0') &&
533 matched_widget = widget; 531 (widget->name[z] == wname[z]) ); z++)
534 prefix_uniq = z;
535 }
536 else if (z == prefix_uniq)
537 { 532 {
538 prefix_common = z; 533 if (z > prefix_uniq)
534 {
535 matched_widget = widget;
536 prefix_uniq = z;
537 }
538 else if (z == prefix_uniq)
539 {
540 prefix_common = z;
541 };
539 }; 542 };
540 }; 543 };
541 544
@@ -546,18 +549,21 @@ const scu_widget * scu_widget_lookup(const char * wname, int exact)
546 { 549 {
547 if (strcmp(widget->alias[y], wname) == 0) 550 if (strcmp(widget->alias[y], wname) == 0)
548 return(widget); 551 return(widget);
549 for(z = 0; ( (widget->alias[y][z] != '\0') && 552 if (!(exact))
550 (wname[z] != '\0') &&
551 (widget->alias[y][z] == wname[z]) ); z++)
552 { 553 {
553 if (z > prefix_uniq) 554 for(z = 0; ( (widget->alias[y][z] != '\0') &&
555 (wname[z] != '\0') &&
556 (widget->alias[y][z] == wname[z]) ); z++)
554 { 557 {
555 matched_widget = widget; 558 if (z > prefix_uniq)
556 prefix_uniq = z; 559 {
557 } 560 matched_widget = widget;
558 else if (z == prefix_uniq) 561 prefix_uniq = z;
559 { 562 }
560 prefix_common = z; 563 else if (z == prefix_uniq)
564 {
565 prefix_common = z;
566 };
561 }; 567 };
562 }; 568 };
563 }; 569 };