Blob Blame History Raw
diff --git a/liboath/usersfile.c b/liboath/usersfile.c
index 462926d..6410f70 100644
--- a/liboath/usersfile.c
+++ b/liboath/usersfile.c
@@ -232,24 +232,23 @@ update_usersfile2 (const char *username,
       char *origline;
       const char *user, *type, *passwd, *secret;
       int r;
+      unsigned digits, totpstepsize;
 
       origline = strdup (*lineptr);
 
       type = strtok_r (*lineptr, whitespace, &saveptr);
       if (type == NULL)
-	continue;
+        goto skip_line;
+
+      /* Read token type */
+      if (parse_type (type, &digits, &totpstepsize) != 0)
+        goto skip_line;
 
       /* Read username */
       user = strtok_r (NULL, whitespace, &saveptr);
       if (user == NULL || strcmp (user, username) != 0
 	  || got_users++ != skipped_users)
-	{
-	  r = fprintf (outfh, "%s", origline);
-	  free (origline);
-	  if (r <= 0)
-	    return OATH_PRINTF_ERROR;
-	  continue;
-	}
+        goto skip_line;
 
       passwd = strtok_r (NULL, whitespace, &saveptr);
       if (passwd == NULL)
@@ -265,6 +264,14 @@ update_usersfile2 (const char *username,
       free (origline);
       if (r <= 0)
 	return OATH_PRINTF_ERROR;
+      continue;
+
+    skip_line:
+      r = fprintf (outfh, "%s", origline);
+      free (origline);
+      if (r <= 0)
+        return OATH_PRINTF_ERROR;
+      continue;
     }
 
   return OATH_OK;