~ubuntu-branches/ubuntu/gutsy/avscan/gutsy-security

« back to all changes in this revision

Viewing changes to avscan/wincb.c

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Berg
  • Date: 2006-08-31 18:52:27 UTC
  • mfrom: (1.2.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060831185227-ol7ren8qsenrzlvh
Tags: 0.8.5-openssl-1
* New upstream release.
* Register html documentation with doc-base.

Show diffs side-by-side

added added

removed removed

Lines of Context:
202
202
        if(STRISEMPTY(path))
203
203
            return(path);
204
204
                         
205
 
        s = strrchr(path, DIR_DELIMINATOR);
 
205
        s = strrchr(path, G_DIR_SEPARATOR);
206
206
        return((s != NULL) ? (s + 1) : path);
207
207
}
208
208
 
290
290
            press = (event->type == GDK_KEY_PRESS) ? TRUE : FALSE;
291
291
            keyval = key->keyval;
292
292
            state = key->state;
293
 
#define DO_STOP_KEY_SIGNAL_EMIT {               \
 
293
#define DO_STOP_KEY_SIGNAL_EMIT {               \
294
294
 gtk_signal_emit_stop_by_name(                  \
295
295
  GTK_OBJECT(widget),                           \
296
296
  press ?                                       \
502
502
            press = (event->type == GDK_KEY_PRESS) ? TRUE : FALSE;
503
503
            keyval = key->keyval;
504
504
            state = key->state;
505
 
#define DO_STOP_KEY_SIGNAL_EMIT {               \
 
505
#define DO_STOP_KEY_SIGNAL_EMIT {               \
506
506
 gtk_signal_emit_stop_by_name(                  \
507
507
  GTK_OBJECT(widget),                           \
508
508
  press ?                                       \
573
573
            {
574
574
              case 1:
575
575
                if(widget == win->scan_clist)
576
 
                {  
 
576
                {
577
577
                    WinStartCB(NULL, win);
578
578
                }
579
579
                break;
862
862
 
863
863
/*
864
864
 *      Win GtkCTree "tree_unselect_row" signal callback.
865
 
 */                       
 
865
 */
866
866
void WinTreeUnselectRowCB(
867
867
        GtkCTree *ctree, GtkCTreeNode *node, gint column,
868
868
        gpointer data                                    
891
891
void WinTreeExpandCB(
892
892
        GtkCTree *ctree, GtkCTreeNode *node, gpointer data
893
893
)
894
 
{  
 
894
{
895
895
        win_struct *win = WIN(data);
896
896
        if((ctree == NULL) || (win == NULL))
897
897
            return;
1116
1116
        clist = (GtkCList *)win->results_clist;
1117
1117
        core = CORE(win->core);
1118
1118
 
1119
 
        /* Need to stop? */
 
1119
        /* User clicked on the stop button? */
1120
1120
        if(win->stop_count > 0)
1121
1121
        {
1122
 
            /* Stop scanning */
 
1122
            gint new_row;
 
1123
 
 
1124
            /* Stop scanning
 
1125
             *
 
1126
             * Mark that this timeout is no longer being called
 
1127
             */
1123
1128
            win->scan_toid = 0;
 
1129
 
 
1130
            new_row = WinResultsListAppend(win, NULL, "Interrupted");
 
1131
            if(new_row > -1)
 
1132
            {
 
1133
                gtk_clist_moveto(clist, new_row, 0, 0.0f, 1.0f);
 
1134
            }
 
1135
 
 
1136
            /* Tell the scanning process to stop scanning, delete
 
1137
             * all the tempory output files, and clean up
 
1138
             */
1124
1139
            WinScanProcessStop(win);
1125
1140
 
1126
 
            WinStatusMessage(win, "Scan interrupted", FALSE);
 
1141
            WinStatusMessage(
 
1142
                win,
 
1143
"Scan interrupted",
 
1144
                FALSE
 
1145
            );
1127
1146
 
1128
1147
            return(FALSE);
1129
1148
        }
1146
1165
             *
1147
1166
             *     The virus engine is out of date, upgrade!
1148
1167
             */
1149
 
            gint len, new_row;
1150
 
            gchar *s, *s2, *path, *virus_name;
 
1168
            gint new_row;
 
1169
            gchar *s_end, *path, *virus_name;
 
1170
            const gchar *s;
1151
1171
 
1152
1172
            while(fgets(buf, sizeof(buf), fp) != NULL)
1153
1173
            {
1154
1174
                buf[sizeof(buf) - 1] = '\0';
1155
1175
 
1156
 
                s = strpbrk(buf, "\n\r");
1157
 
                if(s != NULL)
1158
 
                    *s = '\0';
 
1176
                s_end = strpbrk(buf, "\n\r");
 
1177
                if(s_end != NULL)
 
1178
                    *s_end = '\0';
1159
1179
 
1160
1180
                path = NULL;                    /* Path */
1161
1181
                virus_name = NULL;              /* Virus|problem */
1162
1182
 
1163
1183
                /* Seek past initial spaces */
1164
 
                s = buf;
1165
 
                while(ISBLANK(*s))
1166
 
                    s++;
 
1184
                s = SEEK_PAST_SPACES(buf);
1167
1185
 
1168
1186
                /* Check format, if the first character is a "
1169
1187
                 * then it implies the format is:
1174
1192
                {
1175
1193
                    s++;        /* Seek past initial '"' character */
1176
1194
 
1177
 
                    /* Seek s2 to next '"' character (ignore any escape
1178
 
                     * characters) or end of string
 
1195
                    /* Get the path and increment s past the next '"'
 
1196
                     * character
1179
1197
                     */
1180
 
                    for(s2 = s; *s2 != '\0'; s2++)
1181
 
                    {
1182
 
                        if(*s2 == '"')
1183
 
                            break;
1184
 
                    }
1185
 
                    /* Calculate length and copy path */
1186
 
                    len = (gint)(s2 - s);
1187
 
                    if(len > 0)
1188
 
                    {
1189
 
                        path = (gchar *)g_malloc((len + 1) * sizeof(gchar));
1190
 
                        if(path != NULL)
1191
 
                        {
1192
 
                            memcpy(path, s, len * sizeof(gchar));
1193
 
                            path[len] = '\0';
1194
 
                        }
1195
 
                    }
1196
 
 
1197
 
                    /* Seek s to the start of virus|problem */
1198
 
                    s = (*s2 == '"') ? (s2 + 1) : s2;
1199
 
                    while(ISBLANK(*s))
1200
 
                        s++;
 
1198
                    s = GET_ARG(s, '"', &path);
 
1199
 
 
1200
                    s = SEEK_PAST_SPACES(s);
 
1201
 
 
1202
                    /* Get the virus/problem */
1201
1203
                    virus_name = STRDUP(s);
1202
1204
                }
1203
1205
                else
1204
1206
                {
 
1207
                    /* No path, just get the whole line as the virus
 
1208
                     * name
 
1209
                     */
1205
1210
                    virus_name = STRDUP(s);
1206
1211
                }
1207
1212
 
1450
1455
            win->scan_toid = 0;
1451
1456
            WinScanProcessStop(win);
1452
1457
 
1453
 
            WinStatusMessage(win, "Scan done", TRUE);
 
1458
            WinStatusMessage(
 
1459
                win,
 
1460
"Scan done",
 
1461
                FALSE
 
1462
            );
1454
1463
 
1455
1464
            return(FALSE);
1456
1465
        }