#include <stdio.h>#include <stdlib.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <string.h>#include <unistd.h>#include <sys/ioctl.h>#include "dazukoio_linux_compat1.h"Go to the source code of this file.
|
||||||||||||||||
|
Definition at line 175 of file dazukoio_linux_compat1.c. References dazuko_id::extra_data, IOCTL_SET_OPTION, and NULL. Referenced by dazukoAddExcludePath_TS_compat1(), and dazukoAddIncludePath_TS_compat1(). 00176 {
00177 struct option_compat1 *opt;
00178 int err = 0;
00179
00180 if (dazuko == NULL)
00181 return -1;
00182
00183 if (dazuko->extra_data == NULL)
00184 return -1;
00185
00186 if (path == NULL)
00187 return -1;
00188
00189 if (dazuko->extra_data->device < 0 || dazuko->extra_data->dev_major < 0)
00190 return -1;
00191
00192 opt = (struct option_compat1 *)malloc(sizeof(struct option_compat1));
00193 if (opt == NULL)
00194 return -1;
00195
00196 memset(opt, 0, sizeof(struct option_compat1));
00197
00198 opt->command = command;
00199 strncpy(opt->buffer, path, sizeof(opt->buffer) - 1);
00200 opt->buffer_length = strlen(opt->buffer) + 1;
00201
00202 if (ioctl(dazuko->extra_data->device, _IOW(dazuko->extra_data->dev_major, IOCTL_SET_OPTION, void *), opt) != 0)
00203 err = -1;
00204
00205 free(opt);
00206
00207 return err;
00208 }
|
|
||||||||||||
|
Definition at line 215 of file dazukoio_linux_compat1.c. References ADD_EXCLUDE_PATH, and dazuko_set_path_compat1(). Referenced by dazukoAddExcludePath_TS(). 00216 {
00217 return dazuko_set_path_compat1(dazuko, path, ADD_EXCLUDE_PATH);
00218 }
|
|
||||||||||||
|
Definition at line 210 of file dazukoio_linux_compat1.c. References ADD_INCLUDE_PATH, and dazuko_set_path_compat1(). Referenced by dazukoAddIncludePath_TS(). 00211 {
00212 return dazuko_set_path_compat1(dazuko, path, ADD_INCLUDE_PATH);
00213 }
|
|
||||||||||||
|
Definition at line 296 of file dazukoio_linux_compat1.c. References dazuko_id::extra_data, IOCTL_GET_AN_ACCESS, and NULL. Referenced by dazukoGetAccess_TS_compat1_wrapper(). 00297 {
00298 if (dazuko == NULL)
00299 return -1;
00300
00301 if (dazuko->extra_data == NULL)
00302 return -1;
00303
00304 if (acc == NULL)
00305 return -1;
00306
00307 if (dazuko->extra_data->device < 0 || dazuko->extra_data->dev_major < 0)
00308 return -1;
00309
00310 memset(acc, 0, sizeof(struct access_compat1));
00311
00312 if (ioctl(dazuko->extra_data->device, _IOR(dazuko->extra_data->dev_major, IOCTL_GET_AN_ACCESS, struct access_compat1 *), acc) != 0)
00313 return -1;
00314
00315 return 0;
00316 }
|
|
||||||||||||
|
Definition at line 251 of file dazukoio_linux_compat1.c. References dazukoGetAccess_TS_compat1(), access_compat1::deny, access_compat1::event, access_compat1::filename, NULL, access_compat1::o_flags, access_compat1::o_mode, access_compat1::pid, and access_compat1::uid. Referenced by dazukoGetAccess_TS(). 00252 {
00253 struct access_compat1 acc_compat1;
00254 struct dazuko_access *temp_acc;
00255 int ret;
00256
00257 if (acc == NULL)
00258 return -1;
00259
00260 *acc = NULL;
00261
00262 temp_acc = (struct dazuko_access *)malloc(sizeof(struct dazuko_access));
00263 if (temp_acc == NULL)
00264 return -1;
00265
00266 memset(temp_acc, 0, sizeof(struct dazuko_access));
00267
00268 ret = dazukoGetAccess_TS_compat1(dazuko, &acc_compat1);
00269
00270 if (ret == 0)
00271 {
00272 temp_acc->deny = acc_compat1.deny;
00273 temp_acc->event = acc_compat1.event;
00274 temp_acc->set_event = 1;
00275 temp_acc->flags = acc_compat1.o_flags;
00276 temp_acc->set_flags = 1;
00277 temp_acc->mode = acc_compat1.o_mode;
00278 temp_acc->set_mode = 1;
00279 temp_acc->uid = acc_compat1.uid;
00280 temp_acc->set_uid = 1;
00281 temp_acc->pid = acc_compat1.pid;
00282 temp_acc->set_pid = 1;
00283 temp_acc->filename = strdup(acc_compat1.filename);
00284 temp_acc->set_filename = 1;
00285
00286 *acc = temp_acc;
00287 }
00288 else
00289 {
00290 free(temp_acc);
00291 }
00292
00293 return ret;
00294 }
|
|
||||||||||||
|
Definition at line 84 of file dazukoio_linux_compat1.c. References option_compat1::buffer, option_compat1::buffer_length, option_compat1::command, dazuko_id::extra_data, IOCTL_SET_OPTION, NULL, and REGISTER. Referenced by dazukoRegister_TS_compat1_wrapper(). 00085 {
00086 struct option_compat1 *opt;
00087 char buffer[10];
00088
00089 if (dazuko == NULL)
00090 return -1;
00091
00092 if (dazuko->extra_data == NULL)
00093 return -1;
00094
00095 if (groupName == NULL)
00096 groupName = "_GENERIC";
00097
00098 if (dazuko->extra_data->device < 0)
00099 {
00100
00101 dazuko->extra_data->device = open("/dev/dazuko", 0);
00102 if (dazuko->extra_data->device < 0)
00103 return -1;
00104
00105 memset(buffer, 0, sizeof(buffer));
00106 if (read(dazuko->extra_data->device, buffer, sizeof(buffer)-1) < 1)
00107 {
00108 close(dazuko->extra_data->device);
00109 dazuko->extra_data->device = -1;
00110 return -1;
00111 }
00112
00113 dazuko->extra_data->dev_major = atoi(buffer);
00114 }
00115
00116 opt = (struct option_compat1 *)malloc(sizeof(struct option_compat1));
00117 if (opt == NULL)
00118 {
00119 close(dazuko->extra_data->device);
00120 dazuko->extra_data->device = -1;
00121 dazuko->extra_data->dev_major = -1;
00122 return -1;
00123 }
00124
00125 memset(opt, 0, sizeof(struct option_compat1));
00126
00127 opt->command = REGISTER;
00128 strncpy(opt->buffer, groupName, sizeof(opt->buffer) - 1);
00129 opt->buffer_length = strlen(opt->buffer) + 1;
00130
00131 if (ioctl(dazuko->extra_data->device, _IOW(dazuko->extra_data->dev_major, IOCTL_SET_OPTION, void *), opt) != 0)
00132 {
00133 /* if this fails, it could be a really old version */
00134
00135 /* the original versions registered automatically with open() */
00136 }
00137
00138 free(opt);
00139
00140 return 0;
00141 }
|
|
||||||||||||
|
Definition at line 45 of file dazukoio_linux_compat1.c. References dazukoRegister_TS_compat1(), and NULL. Referenced by dazukoRegister_TS_inner(). 00046 {
00047 int ret;
00048 struct dazuko_id *temp_id;
00049
00050 if (dazuko_id == NULL)
00051 return -1;
00052
00053 temp_id = (struct dazuko_id *)malloc(sizeof(struct dazuko_id));
00054 if (temp_id == NULL)
00055 return -1;
00056
00057 memset(temp_id, 0, sizeof(struct dazuko_id));
00058
00059 temp_id->extra_data = (struct xp_dazukoio_id *)malloc(sizeof(struct xp_dazukoio_id));
00060 if (temp_id->extra_data == NULL)
00061 {
00062 free(temp_id);
00063 return -1;
00064 }
00065
00066 temp_id->extra_data->device = -1;
00067 temp_id->extra_data->dev_major = -1;
00068
00069 ret = dazukoRegister_TS_compat1(temp_id, groupName);
00070
00071 if (ret == 0)
00072 {
00073 *dazuko_id = temp_id;
00074 }
00075 else
00076 {
00077 free(temp_id->extra_data);
00078 free(temp_id);
00079 }
00080
00081 return ret;
00082 }
|
|
|
Definition at line 220 of file dazukoio_linux_compat1.c. References dazuko_id::extra_data, IOCTL_SET_OPTION, NULL, and REMOVE_ALL_PATHS. Referenced by dazukoRemoveAllPaths_TS(). 00221 {
00222 struct option_compat1 *opt;
00223 int err = 0;
00224
00225 if (dazuko == NULL)
00226 return -1;
00227
00228 if (dazuko->extra_data == NULL)
00229 return -1;
00230
00231 if (dazuko->extra_data->device < 0 || dazuko->extra_data->dev_major < 0)
00232 return -1;
00233
00234 opt = (struct option_compat1 *)malloc(sizeof(struct option_compat1));
00235 if (opt == NULL)
00236 return -1;
00237
00238 memset(opt, 0, sizeof(struct option_compat1));
00239
00240 opt->command = REMOVE_ALL_PATHS;
00241 opt->buffer_length = 0;
00242
00243 if (ioctl(dazuko->extra_data->device, _IOW(dazuko->extra_data->dev_major, IOCTL_SET_OPTION, void *), opt) != 0)
00244 err = -1;
00245
00246 free(opt);
00247
00248 return err;
00249 }
|
|
||||||||||||
|
Definition at line 359 of file dazukoio_linux_compat1.c. References dazuko_id::extra_data, IOCTL_RETURN_ACCESS, and NULL. Referenced by dazukoReturnAccess_TS_compat1_wrapper(). 00360 {
00361 if (dazuko == NULL)
00362 return -1;
00363
00364 if (dazuko->extra_data == NULL)
00365 return -1;
00366
00367 if (acc == NULL)
00368 return -1;
00369
00370 if (dazuko->extra_data->device < 0 || dazuko->extra_data->dev_major < 0)
00371 return -1;
00372
00373 if (ioctl(dazuko->extra_data->device, _IOW(dazuko->extra_data->dev_major, IOCTL_RETURN_ACCESS, struct access_compat1 *), acc) != 0)
00374 return -1;
00375
00376 return 0;
00377 }
|
|
||||||||||||||||||||
|
Definition at line 318 of file dazukoio_linux_compat1.c. References dazukoReturnAccess_TS_compat1(), and NULL. Referenced by dazukoGetAccess_TS(), and dazukoReturnAccess_TS(). 00319 {
00320 struct access_compat1 acc_compat1;
00321 int ret = 0;
00322
00323 if (acc == NULL)
00324 return -1;
00325
00326 if (*acc == NULL)
00327 return -1;
00328
00329 if (return_access)
00330 {
00331 memset(&acc_compat1, 0, sizeof(acc_compat1));
00332
00333 acc_compat1.deny = (*acc)->deny;
00334 acc_compat1.event = (*acc)->event;
00335 acc_compat1.o_flags = (*acc)->flags;
00336 acc_compat1.o_mode = (*acc)->mode;
00337 acc_compat1.uid = (*acc)->uid;
00338 acc_compat1.pid = (*acc)->pid;
00339 if ((*acc)->filename != NULL)
00340 {
00341 strncpy(acc_compat1.filename, (*acc)->filename, sizeof(acc_compat1.filename) - 1);
00342 acc_compat1.filename[sizeof(acc_compat1.filename) - 1] = 0;
00343 }
00344
00345 ret = dazukoReturnAccess_TS_compat1(dazuko, &acc_compat1);
00346 }
00347
00348 if (free_access && ret == 0)
00349 {
00350 if ((*acc)->filename != NULL)
00351 free((*acc)->filename);
00352 free(*acc);
00353 *acc = NULL;
00354 }
00355
00356 return ret;
00357 }
|
|
||||||||||||
|
Definition at line 143 of file dazukoio_linux_compat1.c. References dazuko_id::extra_data, IOCTL_SET_OPTION, NULL, and SET_ACCESS_MASK. Referenced by dazukoSetAccessMask_TS(). 00144 {
00145 struct option_compat1 *opt;
00146 int err = 0;
00147
00148 if (dazuko == NULL)
00149 return -1;
00150
00151 if (dazuko->extra_data == NULL)
00152 return -1;
00153
00154 if (dazuko->extra_data->device < 0 || dazuko->extra_data->dev_major < 0)
00155 return -1;
00156
00157 opt = (struct option_compat1 *)malloc(sizeof(struct option_compat1));
00158 if (opt == NULL)
00159 return -1;
00160
00161 memset(opt, 0, sizeof(struct option_compat1));
00162
00163 opt->command = SET_ACCESS_MASK;
00164 opt->buffer[0] = (char)accessMask;
00165 opt->buffer_length = 1;
00166
00167 if (ioctl(dazuko->extra_data->device, _IOW(dazuko->extra_data->dev_major, IOCTL_SET_OPTION, void *), opt) != 0)
00168 err = -1;
00169
00170 free(opt);
00171
00172 return err;
00173 }
|
|
|
Definition at line 397 of file dazukoio_linux_compat1.c. References dazuko_id::extra_data, and NULL. Referenced by dazukoUnregister_TS_compat1_wrapper(). 00398 {
00399 int error = -1;
00400
00401 if (dazuko == NULL)
00402 return -1;
00403
00404 if (dazuko->extra_data == NULL)
00405 return -1;
00406
00407 if (dazuko->extra_data->device >= 0)
00408 error = close(dazuko->extra_data->device);
00409
00410 free(dazuko->extra_data);
00411 dazuko->extra_data = NULL;
00412
00413 return error;
00414 }
|
|
|
Definition at line 379 of file dazukoio_linux_compat1.c. References dazukoUnregister_TS_compat1(), and NULL. Referenced by dazukoUnregister_TS(). 00380 {
00381 int ret;
00382
00383 if (dazuko_id == NULL)
00384 return -1;
00385
00386 ret = dazukoUnregister_TS_compat1(*dazuko_id);
00387
00388 if (ret == 0)
00389 {
00390 free(*dazuko_id);
00391 *dazuko_id = NULL;
00392 }
00393
00394 return ret;
00395 }
|
1.4.2