fixed some newline encodings
authorMartin Willi <martin@strongswan.org>
Thu, 16 Apr 2009 14:00:14 +0000 (14:00 -0000)
committerMartin Willi <martin@strongswan.org>
Thu, 16 Apr 2009 14:00:14 +0000 (14:00 -0000)
src/charon/plugins/eap_sim_file/eap_sim_file_triplets.c
src/charon/plugins/eap_sim_file/eap_sim_file_triplets.h

index 9d30f89..e130c05 100644 (file)
@@ -45,16 +45,16 @@ struct private_eap_sim_file_triplets_t {
         * mutex to lock triplets list
         */
        mutex_t *mutex;
-};\r
+};
 
 /**
  * A single triplet
- */\r
-typedef struct  {\r
-       identification_t *imsi;\r
-       char rand[RAND_LEN];\r
-       char sres[SRES_LEN];\r
-       char kc[KC_LEN];\r
+ */
+typedef struct  {
+       identification_t *imsi;
+       char rand[RAND_LEN];
+       char sres[SRES_LEN];
+       char kc[KC_LEN];
 } triplet_t;
 
 /**
@@ -105,7 +105,7 @@ static bool enumerator_enumerate(triplet_enumerator_t *e, identification_t **ims
                                                                 char **rand, char **sres, char **kc)
 {
        triplet_t *triplet;
-
+       
        if (e->inner->enumerate(e->inner, &triplet))
        {
                e->current = triplet;
@@ -148,45 +148,45 @@ static void parse_token(char *to, char *from, size_t len)
        memset(to, 0, len);
        memcpy(to + len - chunk.len, chunk.ptr, chunk.len);
        free(chunk.ptr);
-}\r
-\r
-/**\r
- * Read the triplets from the file\r
- */\r
-static void read_triplets(private_eap_sim_file_triplets_t *this, char *path)\r
-{\r
-       char line[512];\r
-       FILE *file;\r
-       int i, nr = 0;\r
-       \r
-       file = fopen(path, "r");\r
-       if (file == NULL)\r
-       {\r
+}
+
+/**
+ * Read the triplets from the file
+ */
+static void read_triplets(private_eap_sim_file_triplets_t *this, char *path)
+{
+       char line[512];
+       FILE *file;
+       int i, nr = 0;
+       
+       file = fopen(path, "r");
+       if (file == NULL)
+       {
                DBG1(DBG_CFG, "opening triplet file %s failed: %s", 
-                        path, strerror(errno));\r
-               return;\r
-       }\r
-       \r
-       /* read line by line */\r
-       while (fgets(line, sizeof(line), file))\r
-       {\r
+                        path, strerror(errno));
+               return;
+       }
+       
+       /* read line by line */
+       while (fgets(line, sizeof(line), file))
+       {
                triplet_t *triplet;
                enumerator_t *enumerator;
                char *token;
-               \r
-               nr++;\r
-               /* skip comments, empty lines */\r
-               switch (line[0])\r
-               {\r
-                       case '\n':\r
-                       case '\r':\r
-                       case '#':\r
-                       case '\0':\r
-                               continue;\r
-                       default:\r
-                               break;\r
+               
+               nr++;
+               /* skip comments, empty lines */
+               switch (line[0])
+               {
+                       case '\n':
+                       case '\r':
+                       case '#':
+                       case '\0':
+                               continue;
+                       default:
+                               break;
                }
-               triplet = malloc_thing(triplet_t);\r
+               triplet = malloc_thing(triplet_t);
                memset(triplet, 0, sizeof(triplet_t));
                
                i = 0;
@@ -214,22 +214,22 @@ static void read_triplets(private_eap_sim_file_triplets_t *this, char *path)
                }
                enumerator->destroy(enumerator);
                if (i < 4)
-               {\r
+               {
                        DBG1(DBG_CFG, "error in triplet file, line %d", nr);
                        triplet_destroy(triplet);
                        continue;
-               }\r
-               \r
-               DBG2(DBG_CFG, "triplet: imsi %D\nrand %b\nsres %b\nkc %b",\r
-                        triplet->imsi, triplet->rand, RAND_LEN,\r
+               }
+               
+               DBG2(DBG_CFG, "triplet: imsi %D\nrand %b\nsres %b\nkc %b",
+                        triplet->imsi, triplet->rand, RAND_LEN,
                         triplet->sres, SRES_LEN, triplet->kc, KC_LEN);
                         
-               this->triplets->insert_last(this->triplets, triplet);\r
-       }\r
+               this->triplets->insert_last(this->triplets, triplet);
+       }
        fclose(file);
-       \r
+       
        DBG1(DBG_CFG, "read %d triplets from %s",
-                this->triplets->get_count(this->triplets), path);\r
+                this->triplets->get_count(this->triplets), path);
 }
 
 /**
index a6e9188..38dd5f4 100644 (file)
 
 /**
  * size of RAND value
- */\r
+ */
 #define RAND_LEN 16
 
 /**
  * size of SRES value
- */\r
+ */
 #define SRES_LEN 4
 
 /**
  * size of KC value
- */\r
+ */
 #define KC_LEN 8
 
 typedef struct eap_sim_file_triplets_t eap_sim_file_triplets_t;
@@ -46,7 +46,7 @@ typedef struct eap_sim_file_triplets_t eap_sim_file_triplets_t;
 /**
  * Reads triplets from a triplets.dat file.
  *
- * The file is in freeradius triplet file syntax:\r
+ * The file is in freeradius triplet file syntax:
  * http://www.freeradius.org/radiusd/doc/rlm_sim_triplets
  */
 struct eap_sim_file_triplets_t {