- Timestamp:
- 07/23/06 13:00:20 (18 years ago)
- Location:
- trunk/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/regfio.c
r61 r65 31 31 const unsigned int regfio_num_reg_types = 11; 32 32 static const char* regfio_type_names[] = 33 {"NONE", "SZ", "EXPAND_SZ", "BINARY", "DWORD", "DWORD_BE", "LINK" 33 {"NONE", "SZ", "EXPAND_SZ", "BINARY", "DWORD", "DWORD_BE", "LINK", 34 34 "MULTI_SZ", "RSRC_LIST", "RSRC_DESC", "RSRC_REQ_LIST"}; 35 35 -
trunk/lib/smb_deps.c
r59 r65 4 4 * http://websvn.samba.org/cgi-bin/viewcvs.cgi/trunk/source/ 5 5 * 6 * Copyright (C) 2005 Timothy D. Morgan6 * Copyright (C) 2005-2006 Timothy D. Morgan 7 7 * Copyright (C) 1992-2005 Samba development team 8 8 * (see individual files under Subversion for details.) … … 181 181 if((new_data = zalloc(new_size)) == NULL) 182 182 return false; 183 184 memset(new_data, '\0', (size_t)new_size );185 183 } 186 184 else … … 237 235 bool prs_init(prs_struct *ps, uint32 size, void *ctx, bool io) 238 236 { 237 if(ps == NULL) 238 return false; 239 239 memset(ps, 0, sizeof(prs_struct)); 240 240 241 ps->io = io; 241 242 ps->bigendian_data = RPC_LITTLE_ENDIAN; … … 253 254 return false; 254 255 255 memset(ps->data_p, '\0', (size_t)size);256 256 ps->is_dynamic = true; /* We own this memory. */ 257 257 } … … 279 279 return NULL; 280 280 } 281 281 282 return &ps->data_p[ps->data_offset]; 282 283 } … … 795 796 uint32 old_offset; 796 797 uint32 offset_acl_size; 797 SEC_ACL *psa;798 SEC_ACL* psa; 798 799 799 800 /* … … 804 805 */ 805 806 806 if (ppsa == NULL )807 if (ppsa == NULL || ps == NULL) 807 808 return false; 808 809 … … 819 820 } 820 821 821 depth++; 822 822 depth++; 823 823 old_offset = ps->data_offset; 824 824 825 if(!prs_uint16("revision", ps, depth, &psa->revision) )826 return false;827 828 if(!prs_uint16_pre("size ", ps, depth, &psa->size, &offset_acl_size))829 return false;830 831 if(!prs_uint32("num_aces ", ps, depth, &psa->num_aces))832 return false;825 if(!prs_uint16("revision", ps, depth, &psa->revision) 826 || !prs_uint16_pre("size ", ps, depth, &psa->size, &offset_acl_size) 827 || !prs_uint32("num_aces ", ps, depth, &psa->num_aces)) 828 { 829 free(psa); 830 *ppsa = NULL; 831 return false; 832 } 833 833 834 834 if (ps->io) … … 840 840 */ 841 841 if((psa->ace = (SEC_ACE*)zcalloc(sizeof(SEC_ACE), psa->num_aces+1)) == NULL) 842 return false; 842 { 843 free(psa); 844 *ppsa = NULL; 845 return false; 846 } 843 847 } 844 848 … … 848 852 snprintf(tmp, sizeof(tmp)-1, "ace_list[%02d]: ", i); 849 853 if(!sec_io_ace(tmp, &psa->ace[i], ps, depth)) 850 return false; 854 { 855 free(psa); 856 *ppsa = NULL; 857 return false; 858 } 851 859 } 852 860 … … 864 872 { 865 873 if (!prs_uint8("acl extra space", ps, depth, &c)) 874 { 875 free(psa); 876 *ppsa = NULL; 866 877 return false; 878 } 867 879 } 868 880 } … … 870 882 if(!prs_uint16_post("size ", ps, depth, &psa->size, 871 883 offset_acl_size, old_offset)) 872 { return false; } 884 { 885 free(psa); 886 *ppsa = NULL; 887 return false; 888 } 873 889 874 890 return true; … … 888 904 SEC_DESC *psd; 889 905 890 if (ppsd == NULL )906 if (ppsd == NULL || ps == NULL) 891 907 return false; 892 908 893 909 psd = *ppsd; 894 895 910 if (psd == NULL) 896 911 { … … 913 928 old_offset = ps->data_offset; 914 929 915 if(!prs_uint16("revision ", ps, depth, &psd->revision)) 916 return false; 917 918 if(!prs_uint16("type ", ps, depth, &psd->type)) 919 return false; 920 921 if (!ps->io) 930 if(!prs_uint16("revision ", ps, depth, &psd->revision) 931 || !prs_uint16("type ", ps, depth, &psd->type)) 932 { 933 free(psd); 934 *ppsd = NULL; 935 return false; 936 } 937 938 if (!ps->io) 922 939 { 923 940 uint32 offset = SEC_DESC_HEADER_SIZE; … … 960 977 } 961 978 962 if(!prs_uint32("off_owner_sid", ps, depth, &psd->off_owner_sid)) 963 return false; 964 965 if(!prs_uint32("off_grp_sid ", ps, depth, &psd->off_grp_sid)) 966 return false; 967 968 if(!prs_uint32("off_sacl ", ps, depth, &psd->off_sacl)) 969 return false; 970 971 if(!prs_uint32("off_dacl ", ps, depth, &psd->off_dacl)) 972 return false; 973 979 if(!prs_uint32("off_owner_sid", ps, depth, &psd->off_owner_sid) 980 || !prs_uint32("off_grp_sid ", ps, depth, &psd->off_grp_sid) 981 || !prs_uint32("off_sacl ", ps, depth, &psd->off_sacl) 982 || !prs_uint32("off_dacl ", ps, depth, &psd->off_dacl)) 983 { 984 free(psd); 985 *ppsd = NULL; 986 return false; 987 } 974 988 max_offset = MAX(max_offset, ps->data_offset); 975 989 … … 978 992 tmp_offset = ps->data_offset; 979 993 if(!prs_set_offset(ps, old_offset + psd->off_owner_sid)) 980 return false; 994 { 995 free(psd); 996 *ppsd = NULL; 997 return false; 998 } 981 999 982 1000 if (ps->io) … … 984 1002 /* reading */ 985 1003 if((psd->owner_sid = (DOM_SID*)zalloc(sizeof(DOM_SID))) == NULL) 1004 { 1005 free(psd); 1006 *ppsd = NULL; 986 1007 return false; 1008 } 987 1009 } 988 1010 989 1011 if(!smb_io_dom_sid("owner_sid ", psd->owner_sid , ps, depth)) 990 return false; 1012 { 1013 if(ps->io) 1014 free(psd->owner_sid); 1015 free(psd); 1016 *ppsd = NULL; 1017 return false; 1018 } 991 1019 992 1020 max_offset = MAX(max_offset, ps->data_offset); 993 1021 994 1022 if (!prs_set_offset(ps,tmp_offset)) 995 return false; 1023 { 1024 if(ps->io) 1025 free(psd->owner_sid); 1026 free(psd); 1027 *ppsd = NULL; 1028 return false; 1029 } 996 1030 } 997 1031 … … 1000 1034 tmp_offset = ps->data_offset; 1001 1035 if(!prs_set_offset(ps, old_offset + psd->off_grp_sid)) 1002 return false; 1036 { 1037 if(ps->io) 1038 free(psd->owner_sid); 1039 free(psd); 1040 *ppsd = NULL; 1041 return false; 1042 } 1003 1043 1004 1044 if (ps->io) … … 1006 1046 /* reading */ 1007 1047 if((psd->grp_sid = (DOM_SID*)zalloc(sizeof(DOM_SID))) == NULL) 1048 { 1049 free(psd->owner_sid); 1050 free(psd); 1051 *ppsd = NULL; 1008 1052 return false; 1053 } 1009 1054 } 1010 1055 1011 1056 if(!smb_io_dom_sid("grp_sid", psd->grp_sid, ps, depth)) 1012 return false; 1057 { 1058 if(ps->io) 1059 { 1060 free(psd->grp_sid); 1061 free(psd->owner_sid); 1062 } 1063 free(psd); 1064 *ppsd = NULL; 1065 return false; 1066 } 1013 1067 1014 1068 max_offset = MAX(max_offset, ps->data_offset); 1015 1069 1016 1070 if (!prs_set_offset(ps,tmp_offset)) 1017 return false; 1071 { 1072 if(ps->io) 1073 { 1074 free(psd->grp_sid); 1075 free(psd->owner_sid); 1076 } 1077 free(psd); 1078 *ppsd = NULL; 1079 return false; 1080 } 1018 1081 } 1019 1082 … … 1021 1084 { 1022 1085 tmp_offset = ps->data_offset; 1023 if(!prs_set_offset(ps, old_offset + psd->off_sacl)) 1024 return false; 1025 if(!sec_io_acl("sacl", &psd->sacl, ps, depth)) 1026 return false; 1086 if(!prs_set_offset(ps, old_offset + psd->off_sacl) 1087 || !sec_io_acl("sacl", &psd->sacl, ps, depth)) 1088 { 1089 if(ps->io) 1090 { 1091 free(psd->grp_sid); 1092 free(psd->owner_sid); 1093 } 1094 free(psd); 1095 *ppsd = NULL; 1096 return false; 1097 } 1027 1098 max_offset = MAX(max_offset, ps->data_offset); 1028 1099 if (!prs_set_offset(ps,tmp_offset)) 1029 return false; 1100 { 1101 if(ps->io) 1102 { 1103 free(psd->grp_sid); 1104 free(psd->owner_sid); 1105 } 1106 free(psd); 1107 *ppsd = NULL; 1108 return false; 1109 } 1030 1110 } 1031 1111 … … 1033 1113 { 1034 1114 tmp_offset = ps->data_offset; 1035 if(!prs_set_offset(ps, old_offset + psd->off_dacl)) 1036 return false; 1037 if(!sec_io_acl("dacl", &psd->dacl, ps, depth)) 1038 return false; 1115 if(!prs_set_offset(ps, old_offset + psd->off_dacl) 1116 || !sec_io_acl("dacl", &psd->dacl, ps, depth)) 1117 { 1118 if(ps->io) 1119 { 1120 free(psd->grp_sid); 1121 free(psd->owner_sid); 1122 } 1123 free(psd); 1124 *ppsd = NULL; 1125 return false; 1126 } 1039 1127 max_offset = MAX(max_offset, ps->data_offset); 1040 1128 if (!prs_set_offset(ps,tmp_offset)) 1041 return false; 1129 { 1130 if(ps->io) 1131 { 1132 free(psd->grp_sid); 1133 free(psd->owner_sid); 1134 } 1135 free(psd); 1136 *ppsd = NULL; 1137 return false; 1138 } 1042 1139 } 1043 1140 1044 1141 if(!prs_set_offset(ps, max_offset)) 1045 return false; 1142 { 1143 if(ps->io) 1144 { 1145 free(psd->grp_sid); 1146 free(psd->owner_sid); 1147 } 1148 free(psd); 1149 *ppsd = NULL; 1150 return false; 1151 } 1046 1152 1047 1153 return true; … … 1057 1163 bool sec_ace_equal(SEC_ACE *s1, SEC_ACE *s2) 1058 1164 { 1059 /* Trivial case */1165 /* Trivial cases */ 1060 1166 if (!s1 && !s2) 1061 1167 return true; 1168 if (!s1 || !s2) 1169 return false; 1062 1170 1063 1171 /* Check top level stuff */ … … 1130 1238 bool sec_desc_equal(SEC_DESC *s1, SEC_DESC *s2) 1131 1239 { 1132 /* Trivial case */ 1133 1240 /* Trivial cases */ 1134 1241 if (!s1 && !s2) 1135 goto done; 1242 return true; 1243 if (!s1 || !s2) 1244 return false; 1136 1245 1137 1246 /* Check top level stuff */ … … 1159 1268 return false; 1160 1269 1161 done:1162 1270 return true; 1163 1271 }
Note: See TracChangeset
for help on using the changeset viewer.