2006-07-16 Marcus Brinkmann <marcus@g10code.de>
authorMarcus Brinkmann <mb@g10code.com>
Sun, 16 Jul 2006 13:27:08 +0000 (13:27 +0000)
committerMarcus Brinkmann <mb@g10code.com>
Sun, 16 Jul 2006 13:27:08 +0000 (13:27 +0000)
* rungpg.c (read_status): Strip potential carriage return.
* genkey.c (get_key_parameter): Skip potential carriage return.
* version.c (_gpgme_get_program_version): Strip potential carriage
return.

gpgme/ChangeLog
gpgme/genkey.c
gpgme/rungpg.c
gpgme/version.c

index 23e0e56c8c726d4fa95022dd67656dfcddb6556e..447190f8b4fde65643f5a535f196f6a10b447032 100644 (file)
@@ -1,5 +1,10 @@
 2006-07-16  Marcus Brinkmann  <marcus@g10code.de>
 
+       * rungpg.c (read_status): Strip potential carriage return.
+       * genkey.c (get_key_parameter): Skip potential carriage return.
+       * version.c (_gpgme_get_program_version): Strip potential carriage
+       return.
+
        * data.c (gpgme_data_set_file_name): Allow to clear the file name
        by passing NULL.
 
index 3489c89b6461646b1528b5fc2c6c7e91606d729b..afebb7cb61d70686562007bb00bd8ce6d6ec0b8c 100644 (file)
@@ -142,7 +142,8 @@ get_key_parameter (const char *parms, gpgme_data_t *key_parameter)
 
   endtag = strstr (content, "</GnupgKeyParms>");
   /* FIXME: Check that there are no control statements inside.  */
-  while (*content == '\n')
+  while (content[0] == '\n'
+        || (content[0] == '\r' && content[1] == '\n'))
     content++;
 
   return gpgme_data_new_from_mem (key_parameter, content,
index 1cb4d39b3bda4312060a9fb6a7741d2176479447..349b24dda385eb1b07f92bc649dde3063f425340 100644 (file)
@@ -845,6 +845,8 @@ read_status (engine_gpg_t gpg)
          if (*p == '\n')
            {
              /* (we require that the last line is terminated by a LF) */
+             if (p > buffer && p[-1] = '\r')
+               p[-1] = 0;
              *p = 0;
              if (!strncmp (buffer, "[GNUPG:] ", 9)
                  && buffer[9] >= 'A' && buffer[9] <= 'Z')
index f417f9c8e1c03250319e79d7fbb1d7e5e8f0769b..26d2dae23b24a4bf51dea6c5eccad49f6cc1d660 100644 (file)
@@ -200,6 +200,8 @@ _gpgme_get_program_version (const char *const file_name)
          mark = strchr (&line[linelen], '\n');
          if (mark)
            {
+             if (mark > &line[0] && *mark == '\r')
+               mark--;
              *mark = '\0';
              break;
            }