/* Copyright (c) 2010, Vsevolod Stakhov * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AUTHOR BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" #include "kvstorage.h" #include "kvstorage_bdb.h" #include "util.h" #include "main.h" #include struct bdb_op { struct rspamd_kv_element *elt; enum { BDB_OP_INSERT, BDB_OP_DELETE, BDB_OP_REPLACE } op; }; /* Main bdb structure */ struct rspamd_bdb_backend { backend_init init_func; /*< this callback is called on kv storage initialization */ backend_insert insert_func; /*< this callback is called when element is inserted */ backend_replace replace_func; /*< this callback is called when element is replaced */ backend_lookup lookup_func; /*< this callback is used for lookup of element */ backend_delete delete_func; /*< this callback is called when an element is deleted */ backend_sync sync_func; /*< this callback is called when backend need to be synced */ backend_destroy destroy_func; /*< this callback is used for destroying all elements inside backend */ DB_ENV *envp; /*< db environment */ DB *dbp; /*< db pointer */ gchar *filename; gchar *dirname; guint sync_ops; GQueue *ops_queue; GHashTable *ops_hash; gboolean initialized; }; /* Process single bdb operation */ static gboolean bdb_process_single_op (struct rspamd_bdb_backend *db, DB_TXN *txn, struct bdb_op *op) { DBT db_key, db_data; memset (&db_key, 0, sizeof(DBT)); memset (&db_data, 0, sizeof(DBT)); db_key.size = op->elt->keylen; db_key.data = ELT_KEY (op->elt); db_data.size = op->elt->size + sizeof (struct rspamd_kv_element) + op->elt->keylen + 1; db_data.data = op->elt; switch (op->op) { case BDB_OP_INSERT: case BDB_OP_REPLACE: db_data.flags = DB_DBT_USERMEM; if (db->dbp->put (db->dbp, NULL, &db_key, &db_data, 0) != 0) { return FALSE; } break; case BDB_OP_DELETE: db_data.flags = DB_DBT_USERMEM; /* Set cursor */ if (db->dbp->del (db->dbp, NULL, &db_key, 0) != 0) { return FALSE; } break; } op->elt->flags &= ~KV_ELT_DIRTY; return TRUE; } /* Process operations queue */ static gboolean bdb_process_queue (struct rspamd_kv_backend *backend) { struct rspamd_bdb_backend *db = (struct rspamd_bdb_backend *)backend; struct bdb_op *op; GList *cur; cur = db->ops_queue->head; while (cur) { op = cur->data; if (! bdb_process_single_op (db, NULL, op)) { return FALSE; } cur = g_list_next (cur); } /* Clean the queue */ cur = db->ops_queue->head; while (cur) { op = cur->data; if (op->op == BDB_OP_DELETE || (op->elt->flags & KV_ELT_NEED_FREE) != 0) { /* Also clean memory */ g_slice_free1 (ELT_SIZE (op->elt), op->elt); } g_slice_free1 (sizeof (struct bdb_op), op); cur = g_list_next (cur); } g_hash_table_remove_all (db->ops_hash); g_queue_clear (db->ops_queue); return TRUE; } /* Backend callbacks */ static void rspamd_bdb_init (struct rspamd_kv_backend *backend) { struct rspamd_bdb_backend *db = (struct rspamd_bdb_backend *)backend; guint32 flags; gint ret; if ((ret = db_env_create (&db->envp, 0)) != 0) { /* Cannot create environment */ goto err; } flags = DB_INIT_MPOOL | DB_CREATE | /* Create the environment if it does not already exist. */ DB_INIT_LOCK | /* Initialize locking. */ DB_THREAD; /* Use threads */ if ((ret = db->envp->open (db->envp, db->dirname, flags, 0)) != 0) { /* Cannot open environment */ goto err; } /* * Configure db to perform deadlock detection internally, and to * choose the transaction that has performed the least amount of * writing to break the deadlock in the event that one is detected. */ db->envp->set_lk_detect (db->envp, DB_LOCK_DEFAULT); /* * Avoid explicit sync on committing */ db->envp->set_flags (db->envp, DB_TXN_NOSYNC, 1); flags = DB_CREATE | DB_THREAD; /* Create and open db pointer */ if ((ret = db_create (&db->dbp, db->envp, 0)) != 0) { goto err; } if ((ret = db->dbp->open (db->dbp, NULL, db->filename, NULL, DB_HASH, flags, 0)) != 0) { goto err; } db->initialized = TRUE; return; err: if (db->dbp != NULL) { msg_err ("error opening bdb database: %s", db_strerror (ret)); db->dbp->close (db->dbp, 0); } if (db->envp != NULL) { msg_err ("error opening bdb environment: %s", db_strerror (ret)); db->envp->close (db->envp, 0); } } static gboolean rspamd_bdb_insert (struct rspamd_kv_backend *backend, gpointer key, guint keylen, struct rspamd_kv_element *elt) { struct rspamd_bdb_backend *db = (struct rspamd_bdb_backend *)backend; struct bdb_op *op; if (!db->initialized) { return FALSE; } op = g_slice_alloc (sizeof (struct bdb_op)); op->op = BDB_OP_INSERT; op->elt = elt; elt->flags |= KV_ELT_DIRTY; g_queue_push_head (db->ops_queue, op); g_hash_table_insert (db->ops_hash, elt, op); if (db->sync_ops > 0 && g_queue_get_length (db->ops_queue) >= db->sync_ops) { return bdb_process_queue (backend); } return TRUE; } static gboolean rspamd_bdb_replace (struct rspamd_kv_backend *backend, gpointer key, guint keylen, struct rspamd_kv_element *elt) { struct rspamd_bdb_backend *db = (struct rspamd_bdb_backend *)backend; struct bdb_op *op; if (!db->initialized) { return FALSE; } op = g_slice_alloc (sizeof (struct bdb_op)); op->op = BDB_OP_REPLACE; op->elt = elt; elt->flags |= KV_ELT_DIRTY; g_queue_push_head (db->ops_queue, op); g_hash_table_insert (db->ops_hash, elt, op); if (db->sync_ops > 0 && g_queue_get_length (db->ops_queue) >= db->sync_ops) { return bdb_process_queue (backend); } return TRUE; } static struct rspamd_kv_element* rspamd_bdb_lookup (struct rspamd_kv_backend *backend, gpointer key, guint keylen) { struct rspamd_bdb_backend *db = (struct rspamd_bdb_backend *)backend; struct bdb_op *op; DBT db_key, db_data; struct rspamd_kv_element *elt = NULL; struct rspamd_kv_element search_elt; search_elt.keylen = keylen; search_elt.p = key; if (!db->initialized) { return NULL; } /* First search in ops queue */ if ((op = g_hash_table_lookup (db->ops_hash, &search_elt)) != NULL) { if (op->op == BDB_OP_DELETE) { /* To delete, so assume it as not found */ return NULL; } return op->elt; } memset (&db_key, 0, sizeof(DBT)); memset (&db_data, 0, sizeof(DBT)); db_key.size = keylen; db_key.data = key; db_data.flags = DB_DBT_MALLOC; if (db->dbp->get (db->dbp, NULL, &db_key, &db_data, 0) == 0) { elt = db_data.data; elt->flags &= ~KV_ELT_DIRTY; } return elt; } static void rspamd_bdb_delete (struct rspamd_kv_backend *backend, gpointer key, guint keylen) { struct rspamd_bdb_backend *db = (struct rspamd_bdb_backend *)backend; struct bdb_op *op; struct rspamd_kv_element *elt; struct rspamd_kv_element search_elt; search_elt.keylen = keylen; search_elt.p = key; if (!db->initialized) { return; } if ((op = g_hash_table_lookup (db->ops_hash, &search_elt)) != NULL) { op->op = BDB_OP_DELETE; return; } elt = rspamd_bdb_lookup (backend, key, keylen); if (elt == NULL) { return; } op = g_slice_alloc (sizeof (struct bdb_op)); op->op = BDB_OP_DELETE; op->elt = elt; elt->flags |= KV_ELT_DIRTY; g_queue_push_head (db->ops_queue, op); g_hash_table_insert (db->ops_hash, elt, op); if (db->sync_ops > 0 && g_queue_get_length (db->ops_queue) >= db->sync_ops) { bdb_process_queue (backend); } return; } static void rspamd_bdb_destroy (struct rspamd_kv_backend *backend) { struct rspamd_bdb_backend *db = (struct rspamd_bdb_backend *)backend; if (db->initialized) { bdb_process_queue (backend); if (db->dbp != NULL) { db->dbp->close (db->dbp, 0); } if (db->envp != NULL) { db->envp->close (db->envp, 0); } g_free (db->filename); g_free (db->dirname); g_queue_free (db->ops_queue); g_hash_table_unref (db->ops_hash); g_slice_free1 (sizeof (struct rspamd_bdb_backend), db); } } /* Create new bdb backend */ struct rspamd_kv_backend * rspamd_kv_bdb_new (const gchar *filename, guint sync_ops) { struct rspamd_bdb_backend *new; struct stat st; gchar *dirname; if (filename == NULL) { return NULL; } dirname = g_path_get_dirname (filename); if (dirname == NULL || stat (dirname, &st) == -1 || !S_ISDIR (st.st_mode)) { /* Inaccessible path */ if (dirname != NULL) { g_free (dirname); } msg_err ("invalid file: %s", filename); return NULL; } new = g_slice_alloc0 (sizeof (struct rspamd_bdb_backend)); new->dirname = dirname; new->filename = g_strdup (filename); new->sync_ops = sync_ops; new->ops_queue = g_queue_new (); new->ops_hash = g_hash_table_new (kv_elt_hash_func, kv_elt_compare_func); /* Init callbacks */ new->init_func = rspamd_bdb_init; new->insert_func = rspamd_bdb_insert; new->lookup_func = rspamd_bdb_lookup; new->delete_func = rspamd_bdb_delete; new->replace_func = rspamd_bdb_replace; new->sync_func = bdb_process_queue; new->destroy_func = rspamd_bdb_destroy; return (struct rspamd_kv_backend *)new; } Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
summaryrefslogtreecommitdiffstats
path: root/core/l10n/ar.json
blob: 7a26a719cece1e7efbacd22c81f014ed257e9e36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
{ "translations": {
    "Updated database" : "قاعدة بيانات المرفوعات",
    "Unknown filetype" : "نوع الملف غير معروف",
    "Invalid image" : "الصورة غير صالحة",
    "Sunday" : "الأحد",
    "Monday" : "الأثنين",
    "Tuesday" : "الثلاثاء",
    "Wednesday" : "الاربعاء",
    "Thursday" : "الخميس",
    "Friday" : "الجمعه",
    "Saturday" : "السبت",
    "January" : "كانون الثاني",
    "February" : "شباط",
    "March" : "آذار",
    "April" : "نيسان",
    "May" : "أيار",
    "June" : "حزيران",
    "July" : "تموز",
    "August" : "آب",
    "September" : "أيلول",
    "October" : "تشرين الاول",
    "November" : "تشرين الثاني",
    "December" : "كانون الاول",
    "Settings" : "إعدادات",
    "File" : "ملف",
    "Folder" : "مجلد",
    "Saving..." : "جاري الحفظ...",
    "Reset password" : "تعديل كلمة السر",
    "No" : "لا",
    "Yes" : "نعم",
    "Choose" : "اختيار",
    "Ok" : "موافق",
    "_{count} file conflict_::_{count} file conflicts_" : ["","","","","",""],
    "Cancel" : "الغاء",
    "Very weak password" : "كلمة السر ضعيفة جدا",
    "Weak password" : "كلمة السر ضعيفة",
    "Good password" : "كلمة السر جيدة",
    "Strong password" : "كلمة السر قوية",
    "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." : "اعدادات خادمك غير صحيحة بشكل تسمح لك بمزامنة ملفاتك وذلك بسبب أن واجهة WebDAV تبدو معطلة",
    "This server has no working internet connection. This means that some of the features like mounting of external storage, notifications about updates or installation of 3rd party apps don´t work. Accessing files from remote and sending of notification emails might also not work. We suggest to enable internet connection for this server if you want to have all features." : "هذا الخادم لا يوجد لدية اتصال انترنت. هذا يعني ان بعض الميزات مثل mounting التخزين الخارجي , تنبيهات عن التحديثات او تنزيلات برامج الطرف الثالث3  لا تعمل. الدخول للملفات البعيدة و ارسال تنبيهات البريد الالكتروني ممكن ان لا تعمل ايضا. نحن نقترح بتفعيل اتصال الانترنت لهذا الخادم لتتمكن من الاستفادة من كل الميزات",
    "Shared" : "مشارك",
    "Share" : "شارك",
    "Error" : "خطأ",
    "Error while sharing" : "حصل خطأ عند عملية المشاركة",
    "Error while unsharing" : "حصل خطأ عند عملية إزالة المشاركة",
    "Error while changing permissions" : "حصل خطأ عند عملية إعادة تعيين التصريح بالتوصل",
    "Shared with you and the group {group} by {owner}" : "شورك معك ومع المجموعة {group} من قبل {owner}",
    "Shared with you by {owner}" : "شورك معك من قبل {owner}",
    "Share link" : "شارك الرابط",
    "Password protect" : "حماية كلمة السر",
    "Allow Public Upload" : "اسمح بالرفع للعامة",
    "Email link to person" : "ارسل الرابط بالبريد الى صديق",
    "Send" : "أرسل",
    "Set expiration date" : "تعيين تاريخ إنتهاء الصلاحية",
    "Expiration date" : "تاريخ إنتهاء الصلاحية",
    "group" : "مجموعة",
    "Resharing is not allowed" : "لا يسمح بعملية إعادة المشاركة",
    "Shared in {item} with {user}" : "شورك في {item} مع {user}",
    "Unshare" : "إلغاء مشاركة",
    "can share" : "يمكن المشاركة",
    "can edit" : "التحرير مسموح",
    "access control" : "ضبط الوصول",
    "create" : "إنشاء",
    "update" : "تحديث",
    "delete" : "حذف",
    "Password protected" : "محمي بكلمة السر",
    "Error unsetting expiration date" : "حصل خطأ عند عملية إزالة تاريخ إنتهاء الصلاحية",
    "Error setting expiration date" : "حصل خطأ عند عملية تعيين تاريخ إنتهاء الصلاحية",
    "Sending ..." : "جاري الارسال ...",
    "Email sent" : "تم ارسال البريد الالكتروني",
    "Warning" : "تحذير",
    "The object type is not specified." : "نوع العنصر غير محدد.",
    "Delete" : "إلغاء",
    "Add" : "اضف",
    "The update was successful. Redirecting you to ownCloud now." : "تم التحديث بنجاح , يتم اعادة توجيهك الان الى Owncloud",
    "%s password reset" : "تمت إعادة ضبط كلمة مرور %s",
    "Use the following link to reset your password: {link}" : "استخدم هذه الوصلة لاسترجاع كلمة السر: {link}",
    "You will receive a link to reset your password via Email." : "سوف نرسل لك بريد يحتوي على وصلة لتجديد كلمة السر.",
    "Username" : "إسم المستخدم",
    "Yes, I really want to reset my password now" : "نعم، أريد إعادة ضبظ كلمة مروري",
    "New password" : "كلمات سر جديدة",
    "Personal" : "شخصي",
    "Users" : "المستخدمين",
    "Apps" : "التطبيقات",
    "Admin" : "المدير",
    "Help" : "المساعدة",
    "Access forbidden" : "التوصّل محظور",
    "Security Warning" : "تحذير أمان",
    "Your PHP version is vulnerable to the NULL Byte attack (CVE-2006-7243)" : "Your PHP version is vulnerable to the NULL Byte attack (CVE-2006-7243)",
    "Please update your PHP installation to use %s securely." : "يرجى تحديث نسخة PHP لاستخدام %s بطريقة آمنة",
    "Your data directory and files are probably accessible from the internet because the .htaccess file does not work." : "مجلدات البيانات والملفات الخاصة قد تكون قابلة للوصول اليها عن طريق شبكة الانترنت وذلك بسبب ان ملف .htaccess  لا يعمل بشكل صحيح.",
    "For information how to properly configure your server, please see the <a href=\"%s\" target=\"_blank\">documentation</a>." : "لمزيد من المعلومات عن كيفية إعداد خادمك، يرجى الاطلاع على <a href=\"%s\" target=\"_blank\">صفحة المساعدة</a>.",
    "Create an <strong>admin account</strong>" : "أضف </strong>مستخدم رئيسي <strong>",
    "Password" : "كلمة المرور",
    "Data folder" : "مجلد المعلومات",
    "Configure the database" : "أسس قاعدة البيانات",
    "Database user" : "مستخدم قاعدة البيانات",
    "Database password" : "كلمة سر مستخدم قاعدة البيانات",
    "Database name" : "إسم قاعدة البيانات",
    "Database tablespace" : "مساحة جدول قاعدة البيانات",
    "Database host" : "خادم قاعدة البيانات",
    "Finish setup" : "انهاء التعديلات",
    "Log out" : "الخروج",
    "remember" : "تذكر",
    "Log in" : "أدخل",
    "Alternative Logins" : "اسماء دخول بديلة"
},"pluralForm" :"nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;"
}