Commit 123ca3a3 123ca3a362e8415f07127a188e74a458f9efb33f by Alain Magloire

* mailbox/wicket.c (_get_ticket): Reset the buffer.

1 parent babebed6
1 2001-11-14 Alain Magloire 1 2001-11-14 Alain Magloire
2 2
3 * mailbox/wicket.c (_get_ticket): Reset the buffer.
4
5 2001-11-14 Alain Magloire
6
3 To provide an easy way to crete a ticket_t from 7 To provide an easy way to crete a ticket_t from
4 a file, one can create a wicket_t and fetch ticket_t's 8 a file, one can create a wicket_t and fetch ticket_t's
5 for different users to set on the authority. 9 for different users to set on the authority.
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
14 You should have received a copy of the GNU Library General Public License 14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
17 #ifdef HAVE_CONFIG_H 18 #ifdef HAVE_CONFIG_H
18 # include <config.h> 19 # include <config.h>
19 #endif 20 #endif
...@@ -155,8 +156,8 @@ _get_ticket (ticket_t *pticket, const char *filename, const char *user) ...@@ -155,8 +156,8 @@ _get_ticket (ticket_t *pticket, const char *filename, const char *user)
155 ptr = buf + len; 156 ptr = buf + len;
156 continue; 157 continue;
157 } 158 }
158 else 159
159 ptr = buf; 160 ptr = buf;
160 161
161 /* Comments. */ 162 /* Comments. */
162 if (*ptr == '#') 163 if (*ptr == '#')
...@@ -171,8 +172,8 @@ _get_ticket (ticket_t *pticket, const char *filename, const char *user) ...@@ -171,8 +172,8 @@ _get_ticket (ticket_t *pticket, const char *filename, const char *user)
171 172
172 /* user:passwd. Separator maybe ": \t" */ 173 /* user:passwd. Separator maybe ": \t" */
173 if (len && ((sep = memchr (ptr, ':', len)) != NULL 174 if (len && ((sep = memchr (ptr, ':', len)) != NULL
174 || (sep = memchr (ptr, ' ', len)) != NULL 175 || (sep = memchr (ptr, ' ', len)) != NULL
175 || (sep = memchr (ptr, '\t', len)) != NULL)) 176 || (sep = memchr (ptr, '\t', len)) != NULL))
176 { 177 {
177 *sep++ = '\0'; 178 *sep++ = '\0';
178 ptr = stripwhite (ptr); 179 ptr = stripwhite (ptr);
...@@ -183,6 +184,7 @@ _get_ticket (ticket_t *pticket, const char *filename, const char *user) ...@@ -183,6 +184,7 @@ _get_ticket (ticket_t *pticket, const char *filename, const char *user)
183 break; 184 break;
184 } 185 }
185 } 186 }
187 ptr = buf;
186 } 188 }
187 } 189 }
188 else 190 else
...@@ -209,7 +211,7 @@ myticket_create (ticket_t *pticket, const char *user, const char *pass) ...@@ -209,7 +211,7 @@ myticket_create (ticket_t *pticket, const char *user, const char *pass)
209 ticket_set_pop (*pticket, myticket_pop, NULL); 211 ticket_set_pop (*pticket, myticket_pop, NULL);
210 ticket_set_data (*pticket, mdata, NULL); 212 ticket_set_data (*pticket, mdata, NULL);
211 if ((mdata->user = strdup (user)) == NULL 213 if ((mdata->user = strdup (user)) == NULL
212 || (mdata->pass = strdup (pass)) == NULL) 214 || (mdata->pass = strdup (pass)) == NULL)
213 { 215 {
214 status = ENOMEM; 216 status = ENOMEM;
215 ticket_destroy (pticket, NULL); 217 ticket_destroy (pticket, NULL);
......