Changeset 65
- Timestamp:
- 04/14/04 19:53:28 (5 years ago)
- Files:
-
- trunk/wifidog/ChangeLog (modified) (1 diff)
- trunk/wifidog/src/auth.c (modified) (2 diffs)
- trunk/wifidog/src/centralserver.c (modified) (1 diff)
- trunk/wifidog/src/userclasses.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wifidog/ChangeLog
r64 r65 1 1 # $Header$ 2 2004-04-14 Alexandre Carmel-Veilleux <acv@acv.ca> 3 * Major retooling of insert_userclass(), fixed seg fault. 4 * The program now works as advertised. 5 2 6 2004-04-14 Alexandre Carmel-Veilleux <acv@acv.ca> 3 7 * Switched to threads. Alpha quality build, at best trunk/wifidog/src/auth.c
r64 r65 88 88 89 89 tmp_uc = find_userclasses(profile); 90 90 91 91 if (tmp_uc == NULL) { 92 92 debug(D_LOG_DEBUG, "Profile %d undefined", profile); … … 94 94 node->fd = 0; 95 95 return; 96 } else { 97 debug(D_LOG_DEBUG, "Profile %d UserClasses retrieved", profile); 96 98 } 97 99 trunk/wifidog/src/centralserver.c
r47 r65 62 62 sizeof(struct sockaddr)) == -1) { 63 63 debug(D_LOG_ERR, "connect(): %s", strerror(errno)); 64 exit(1);64 return(-1); /* non-fatal */ 65 65 } 66 67 sprintf(buf, "GET %s?ip=%s&mac=%s&token=%s&stats=%ld HTTP/1.1\nHost: " 68 "%s\n\n", config.authserv_path, ip, mac, token, stats, 69 config.authserv_hostname); 66 sprintf(buf, "GET %s?ip=%s&mac=%s&token=%s&stats=%ld HTTP/1.1" 67 "\nHost: %s\n\n", config.authserv_path, ip, mac, token, 68 stats, config.authserv_hostname); 70 69 send(sockfd, buf, strlen(buf), 0); 71 70 trunk/wifidog/src/userclasses.c
r44 r65 87 87 tmp_uc = class_list; 88 88 89 if (tmp_uc == NULL) { 89 /* first */ 90 if (class_list == NULL) { 90 91 class_list = class; 91 } else {92 /* Skip to our place in the ordered list, or the end */93 while (tmp_uc->profile < class->profile 94 && tmp_uc->next != NULL)95 tmp_uc = tmp_uc->next;96 97 if (tmp_uc->profile == class->profile) {98 /* swap in place */99 if (tmp_uc->prev != NULL)100 tmp_uc->prev->next = class;101 92 return; 93 } 94 95 /* duplicate */ 96 if ((tmp_uc = find_userclasses(class->profile)) != NULL) { 97 if (tmp_uc == class_list) { 98 class_list = class; 99 class->next = tmp_uc->next; 100 } else { 101 class->next = tmp_uc->next; 102 class->prev = tmp_uc->prev; 102 103 if (tmp_uc->next != NULL) 103 104 tmp_uc->next->prev = class; 104 105 class->prev = tmp_uc->prev; 106 class->next = tmp_uc->next; 107 free_userclasses(tmp_uc); 108 } else if (tmp_uc->next == NULL) { 109 /* last item */ 110 tmp_uc->next = class; 111 class->prev = tmp_uc; 112 } else { 113 /* in between two elements */ 114 class->next = tmp_uc->next; 115 class->prev = tmp_uc; 116 tmp_uc->next = class; 117 class->next->prev = class; 105 tmp_uc->prev->next = class; 118 106 } 119 } 107 return; 108 } 109 110 /* new */ 111 tmp_uc = class_list; 112 113 /* new first item */ 114 if (tmp_uc->profile > class->profile) { 115 class_list = class; 116 class->next = tmp_uc; 117 tmp_uc->prev = class; 118 return; 119 } 120 121 /* seek previous record */ 122 while (tmp_uc->next != NULL && tmp_uc->profile < class->profile) 123 tmp_uc = tmp_uc->next; 124 125 /* new last record */ 126 if (tmp_uc->next == NULL) { 127 tmp_uc->next = class; 128 class->prev = tmp_uc; 129 return; 130 } 131 132 /* just a normal insertion */ 133 class->next = tmp_uc->next; 134 class->prev = tmp_uc; 135 tmp_uc->next = class; 136 class->next->prev = class; 137 138 return; 120 139 } 121 140 … … 134 153 if (tmp_uc == NULL) 135 154 return NULL; 136 155 137 156 return tmp_uc; 138 157 }
