Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37909100
en ru br
Репозитории ALT

Группа :: Система/Ядро и оборудование
Пакет: ckermit

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: cku211-string_comparison.diff
Скачать


--- ckuus3.c
+++ ckuus3.c
@@ -10283,20 +10283,22 @@
               int i,len;
               if ((y = cmtxt("Prompt string","",&s,xxstring)) < 0)
                 return(y);
-              if (s == "") s = NULL;
+              if (s && !strlen(s)) s = NULL;
               if (s) {
                   s = brstrip(s);
-                  if (s == "") s = NULL;
+                  if (s && !strlen(s)) s = NULL;
               }
               /* we must check to make sure there are no % fields */
-              len = strlen(s);
-              for (i = 0; i < len; i++) {
-                  if (s[i] == '%') {
-                      if (s[i+1] != '%') {
-                          printf("%% fields are not used in this command.\n");
-                          return(-9);
+              if (s) {
+                  len = strlen(s);
+                  for (i = 0; i < len; i++) {
+                      if (s[i] == '%') {
+                          if (s[i+1] != '%') {
+                              printf("%% fields are not used in this command.\n");
+                              return(-9);
+                          }
+                          i++;
                       }
-                      i++;
                   }
               }
               makestr(&tn_pr_uid,s);
@@ -12400,33 +12402,35 @@
                       krb4_autodel = z;
                     break;
                   case XYKRBPRM:        /* Prompt */
-                    if (s == "") s = NULL;
+                    if (s && !strlen(s)) s = NULL;
                     if (s) {
                         s = brstrip(s);
-                        if (s == "") s = NULL;
+                        if (s && !strlen(s)) s = NULL;
                     }
                     switch (z) {
                       case KRB_PW_PRM: { /* Password */
                           /* Check that there are no more than */
                           /* two % fields and % must followed by 's'. */
                           int i,n,len;
-                          len = strlen(s);
-                          for (i = 0, n = 0; i < len; i++) {
-                              if (s[i] == '%') {
-                                  if (s[i+1] != '%') {
-                                      if (s[i+1] != 's') {
-                                          printf(
-                                           "Only %%s fields are permitted.\n"
-                                                 );
-                                          return(-9);
-                                      }
-                                      if (++n > 2) {
-                                          printf(
-                                      "Only two %%s fields are permitted.\n");
-                                          return(-9);
+                          if (s) {
+                              len = strlen(s);
+                              for (i = 0, n = 0; i < len; i++) {
+                                  if (s[i] == '%') {
+                                      if (s[i+1] != '%') {
+                                          if (s[i+1] != 's') {
+                                              printf(
+                                               "Only %%s fields are permitted.\n"
+                                                     );
+                                              return(-9);
+                                          }
+                                          if (++n > 2) {
+                                              printf(
+                                          "Only two %%s fields are permitted.\n");
+                                              return(-9);
+                                          }
                                       }
+                                      i++;
                                   }
-                                  i++;
                               }
                           }
                           if (kv == 5)
@@ -12438,15 +12442,17 @@
                       case KRB_PR_PRM: { /* Principal */
                           /* Check to make sure there are no % fields */
                           int i,len;
-                          len = strlen(s);
-                          for (i = 0; i < len; i++) {
-                              if (s[i] == '%') {
-                                  if (s[i+1] != '%') {
-                                      printf(
-                                  "%% fields are not used in this command.\n");
-                                      return(-9);
+                          if (s) {
+                              len = strlen(s);
+                              for (i = 0; i < len; i++) {
+                                  if (s[i] == '%') {
+                                      if (s[i+1] != '%') {
+                                          printf(
+                                      "%% fields are not used in this command.\n");
+                                          return(-9);
+                                      }
+                                      i++;
                                   }
-                                  i++;
                               }
                           }
                           if (kv == 5)
@@ -12487,32 +12493,34 @@
                   return(y);
                 switch (x) {            /* Copy value to right place */
                   case XYSRPPRM:        /* Prompt */
-                    if (s == "") s = NULL;
+                    if (s && !strlen(s)) s = NULL;
                     if (s) {
                         s = brstrip(s);
-                        if (s == "") s = NULL;
+                        if (s && !strlen(s)) s = NULL;
                     }
                     switch (z) {
                       case SRP_PW_PRM: { /* Password */
                           /* Check %s fields */
                           int i,n,len;
-                          len = strlen(s);
-                          for (i = 0, n = 0; i < len; i++) {
-                              if (s[i] == '%') {
-                                  if (s[i+1] != '%') {
-                                      if (s[i+1] != 's') {
-                                          printf(
-                                          "Only %%s fields are permitted.\n");
-                                          return(-9);
-                                      }
-                                      if (++n > 1) {
-                                          printf(
-                                       "Only one %%s field is permitted.\n");
-                                          return(-9);
-                                      }
+                          if (s) {
+                              len = strlen(s);
+                              for (i = 0, n = 0; i < len; i++) {
+                                  if (s[i] == '%') {
+                                      if (s[i+1] != '%') {
+                                          if (s[i+1] != 's') {
+                                              printf(
+                                              "Only %%s fields are permitted.\n");
+                                              return(-9);
+                                          }
+                                          if (++n > 1) {
+                                              printf(
+                                           "Only one %%s field is permitted.\n");
+                                              return(-9);
+                                          }
+                                       }
+                                      i++;
                                   }
-                                  i++;
-                              }
+                             }
                           }
                           makestr(&srppwprompt,s);
                           break;
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin